
22 Cal.Rptr.3d 295 (2004)
124 Cal.App.4th 1344
David M. HORWITZ et al., Plaintiffs and Respondents,
v.
CITY OF LOS ANGELES, Defendant and Appellant;
Mehr Z. Beglari et al., Real Parties in Interest and Appellants.
No. B172053.
Court of Appeal, Second District, Division One.
December 15, 2004.
Review Denied March 23, 2005.
*296 Rockard J. Delgadillo, City Attorney, Sharon Siedorf Cardenas, Assistant City Attorney, and Michael L. Klekner, Deputy City Attorney, for Defendant and Appellant.
Mark E. Baker, Calabasas, for Real Parties in Interest and Appellants.
Paul, Hastings, Janofsky & Walker, Geoffrey L. Thomas and Jason M. Frank, Los Angeles, for Plaintiffs and Respondents.
VOGEL, J.
A homeowner who remodeled his house obtained a permit based on an erroneous calculation of the required front-yard setback, so that the house, now completed, is 14 feet closer to the street than permitted by the governing sections of the Los Angeles Municipal Code. Neighbors objected, challenging the permit at the administrative level and in court, and ultimately obtained a judgment directing the City of Los Angeles to revoke the permits. The City and the homeowner appeal. We reject their claims of error and affirm the judgment.

FACTS

A.
Mehr and Vickey Beglari (collectively Beglari) own a house at 909 Greentree Road, in the Rustic Canyon area of Pacific Palisades. In 2000, Beglari (a contractor) decided to enlarge his home and submitted a series of plot plans and permit applications to the City of Los Angeles to obtain approval for an addition that dramatically reduced the front-yard setback, increased the height of the structure, and reduced the width of a side yard.
Several permits were issued to Beglari, including among others a permit issued in January 2001 by the City's Department of Building and Safety to authorize the construction of a 6,550 square-foot, two-story addition to Beglari's existing 2,000 square-foot house; a permit issued in November 2001 to authorize the movement of a side wall; and one issued in March 2002 to authorize an increase in the height of the driveway (by the addition of dirt) to raise the ground level so the roofline of the addition would not exceed height limits measured from ground level.

B.
On March 25, 2002, David Horwitz (and other nearby property owners included in our references to Horwitz) challenged the permits issued to Beglari by way of an appeal to the City's Board of Building and Safety Commissioners. Horwitz claimed (1) the height of Beglari's proposed addition was excessive, (2) the proposed addition would impermissibly reduce the front-yard *297 setback because the prevailing front-yard setback had been incorrectly measured by Beglari, and (3) the enlarged residence would impermissibly reduce the size of the required side yards.[1]
On April 8 (while the just-mentioned administrative appeal was pending), Horwitz sued the City (and Beglari as real party in interest) for declaratory and injunctive relief, asking the court to compel the City to revoke Beglari's building permits and to issue a stop work order. The lawsuit repeated the claims asserted by Horwitz in his administrative appeal, and also alleged that judicial relief was necessary because the Board would not hear his appeal until May at the earliest, and that Beglari had rejected his request to voluntarily discontinue construction until the dispute was resolved. The City challenged all of the judges of the Los Angeles County Superior Court and the case was transferred to the Orange County Superior Court  which found that Horwitz had demonstrated a probability of success on the merits of his claim that Beglari's addition violated various zoning codes, but nevertheless refused to issue a preliminary injunction on the ground that Horwitz had not exhausted his administrative remedies and because construction was by then almost complete. At the same time, the court rejected Beglari's contention that Horwitz's claims were barred by laches, noting that "it appear[ed] that [Beglari] knowingly proceeded despite ... objections [from Horwitz]."

C.
In July, the Board of Building and Safety Commissioners rejected Horwitz's challenges, and Horwitz then appealed to the City's Office of Zoning Administration. On August 19, while the administrative proceedings were pending, the Department of Building and Safety issued a certificate of occupancy to Beglari.
In September, Horwitz's appeal was heard by Zoning Administrator Lourdes Green, who (in October) rejected Horwitz's challenge to the height and side-yard determinations but agreed with Horwitz's challenge to the front-yard setback determination. The Zoning Administrator found that the formula for measuring front-yard setbacks for new construction is stated in section 12.07.01 C.1 of the Los Angeles Municipal Code, and noted that the only dispute is about the numbers used in the application of that formula to Beglari's lot.[2] In rough terms, the front-yard *298 setback is determined by measuring the distance from the property line at the street to the closest existing building on the subject lot, then measuring the same distance on qualifying adjacent lots (houses on the same street), then averaging those distances to arrive at the permissible post-construction setback for the subject lot. The issue before us turns on the meaning of closest existing building. According to a Senior Structural Engineer who is the Chief of the Department's Specialty Engineering Section, this measurement "typically" is the distance from the property line to the existing house. An attached garage is part of the house, but a detached garage is not; when there is a house with a detached front garage, the measurement is from the property line to the house, not from the property line to the detached structure that is closer to the street.
Beglari considered four lots when he submitted his permit application: Lot 5 (Beglari's lot at 909 Greentree), Lot 4 (911 Greentree), Lot 3 (921 Greentree), and Lot 2 (925 Greentree). The dispute is about the setback measurement of Lot 4  which, when measured from the property line to the main house is 30.75 feet, but when measured to a detached garage is only 17.58 feet. Beglari, whose proposed plan obscured the fact that there was a detached garage on Lot 4, used the lower number which, when plugged into the formula, means his remodeled house encroaches 14 feet into the permitted setback area or, put the other way, that his permit allowed his remodeled house to be built 14 feet closer to the street than it would have been had he used the 30.75 feet measurement. Based on the evidence presented at the administrative hearing, the Zoning Administrator made these findings about the setback:
"To the extent ... the formula represents a mathematical equation where specific numbers are plugged in, there is ... no ruling or discretion required of the Board. The significance of this formula depends on the front yard depth of the lots which remain eligible for determining the front yard calculation. A discrepancy in the measurement, inclusion or exclusion of even one of the lots under review, can lead to a wholly different result in the determination of the required front yard for a proposed project. Thus, the most significant aspect of this [administrative appeal] rests solely on whether the front yard depth of ... Lot 4[] to the prevailing front yard calculation should have been measured to a detached garage or to the main building.

"The Department acknowledged that it did not know originally that the garage in question was detached. Had this been originally represented as such, the inference is that the front yard for such lot would have been measured to the main building on said lot, which had a deeper setback than the detached garage. Thus, the resultant computation for the prevailing front yard setback would have been different from what was originally approved by the Department.
"The Department noted that it questioned how the garage could be placed within the front yard of Lot 4. As a result, staff researched the 1950 Code in place at the time of the development of *299 the street to find what provisions would have allowed such a garage to encroach into a front yard.... [¶] The Department presented the Board with the concept referred to as `in line' as a justification for determining that the detached garage did not encroach into the front yard.[[3]] Under this determination and reasoning, the original prevailing front yard approved for the subject project[] would remain as approved. The Department further noted that it could find no provisions in the 1950 Code which would allow garages in the front yard. [Horwitz] contested this and pointed out that the 1950 Code reflected many of the same provisions and exceptions that exist in the current code, which allow for accessory buildings to be located in the front yard. This argument is valid as a review of the 1950 Code contains various provisions associated with these allowances.... [See, e.g., L.A. Mun.Code § 12.22.12(a)(3).]
"The [Board's] ... assumption [was] that the Code that was to be reviewed [included] the provisions of the 1950 Code and the current Code regarding front yard prevailing setbacks and accessory buildings.... [T]he Board ... rule[d] in favor of the Department[, and] made findings that[,] based on the `in line' concept, the garage was not within the front yard and that based on its study of specific provisions of the Code, the Department had correctly applied and calculated the yard setbacks.
"The 1950 Code provisions [relied on by the Department] are not very illustrative of the `in line' reasoning presented by the Department. No reference could be found in the Code that identifies the `in line' concept. Department staff noted that the `in line' approach was in fact similar to the prevailing front yard setback approach. If this were the case, then it must be recognized that the thrust of the prevailing front yard setback is to create adequate setbacks for aesthetic purposes in single-family areas and to maintain deep setbacks if such is the prevailing pattern. If a pattern of deep setbacks exists, then logically the calculation should result in a setback that is more in keeping with the existing setbacks and not one that allows for a substantial reduction in the front yard.

"In this instance, [the] Department staff has indicated that it was not aware of any other situation which would result in a prevailing front yard setback being allowed to be measured to a detached accessory building. No historic written documentation or Department policy establishing the use of the `in line' concept to calculate required front yard was referenced by the Department staff. The Department used a situation that at best may be considered an anomaly to arrive at a conclusion which in fact would establish a new standard citywide for the measurement of prevailing front yard setbacks for lots with similar characteristics. Contrary to current practice, under this approach the accessory building, which is subordinate by definition to the main building, would be allowed to be the driving force in the calculation of prevailing front yard setback. Within this context, it must be concluded that the Department erred in arriving at this interpretation. [¶] Consequently, the Board also erred *300 in sustaining the action of the Department to allow the measurement of the front yard on Lot 4 to be measured to the detached garage instead of to the main building as has otherwise been the practice." (Emphasis added.)
In short, the Zoning Administrator found that Beglari's addition encroaches about 14 feet into the area of the required front-yard setback.

D.
Beglari appealed to the Planning Commission, which held a hearing but took no new evidence (although the lawyers for all concerned parties were allowed to describe various events), then rejected the Zoning Administrator's decision and ruled in favor of Beglari on the setback issue. A final determination letter was issued in February 2003. The Planning Commission's findings, in their entirety, are nothing more than a list of the parties' arguments:
"Prevailing front yard setback....

" DBS [Department of Building and Safety] have [sic] its own options to address this;
" Results can be radically different when measurements are taken from attached and/or detached structures;
" Landscaping obscures view of front yard setbacks of three of the four lots under consideration;
" `In-line' explanation is attempt to relate to prevailing setbacks;
" A conclusion could result in the demolition of 14 feet of the house;

" DBS has to be able to exercise discretion and interpret the LAMC for purpose and fairness;
" BBSC [Board of Building and Safety Commissioners] did not abuse their [sic] discretion due to the LAMC being `silent' on where measurements are taken from;
" Disagree with Zoning Administrator's determination that BBSC erred in their [sic] decision due to a LAMC that lacks clarity on the matter;
" Neighbors and neighborhood;
" Encouraged them to `pull together' and settle their differences;
" Should not go home disappointed;
" Organize and focus on what they ultimately want for the neighborhood;
" Can consider standards for the neighborhood;
" LAMC should be amended;
" BBSC made a decision to a very specific case under very unique circumstances;

" Not setting a precedent Citywide;

" Precedent is a non-issue in this decision;

" Find Zoning Administrator did err in her decision that BBSC did err in its decision; and
" Grant the appeal (passed unanimously)." (Emphasis added.)

E.
In March, in the action he had filed when he sought injunctive relief to stop Beglari's construction, Horwitz filed an amended pleading in which he sought relief by way of administrative mandamus. (Code Civ. Proc., § 1094.5.) The City and Beglari answered, an administrative record was lodged, and a hearing was held, after which the trial court ruled that the sole issue was "whether the City correctly granted building permits and certificates of occupancy to [Beglari] based upon the City's calculation of the front yard setback." The trial court reviewed the administrative *301 record, found the City had prejudicially abused its discretion in that it had not proceeded in the manner required by law, that its decision was not supported by the administrative findings, and that the findings were not supported by substantial evidence, explaining its ruling this way:
"The City's use of the `in line' theory of calculating [Beglari's] prevailing front yard set back is not supported by any reasonable interpretation of the Los Angeles Municipal Code. The court recognizes that the interpretation of the regulations and governing statutes used by the administrative agency charged with enforcing zoning laws is entitled to great weight and should be followed unless clearly wrong. Nevertheless, the ultimate interpretation of such regulations and statutes is a question of law[, and the] court is not bound by the construction given such law by the City.... `If the words of the statute are clear, the court should not add to or alter them to accomplish a purpose that does not appear on the face of the statute or from its legislative history.' [Citation.] Here, the words of section 12.07.01[C.1] of the Zoning Ordinance are clear in stating the method by which the prevailing front yard setbacks are to be determined.
"The in line theory as an alternative method of calculating the prevailing front yard setback is not supported by any reasonable interpretation of the governing provisions of the Municipal Code. The City has no discretion to disregard what appears to be the clear meaning of section 12.07.01[C.1] of the Zoning Ordinance. This section establishes the mathematical computation to be used in determining the prevailing front yard setback. Further, the restrictions on the location of accessory buildings, including detached garages, are inapposite to this computation. (See LAMC § 12.21 C.5(k), formerly § 12.22.12 of the 1950 Zoning Code.) [The City] concedes the in line theory of calculation was never previously applied to circumstances similar to those presented in the instant case, and [it] appears to this court to have been resorted to only to avoid a perceived unfair result to [Beglari]. The analysis of [the] Zoning Administrator[] appears to be correct and is the method historically and consistently used by the City since the enactment of the zoning ordinance." (Emphasis added.)
A judgment granting Horwitz's petition for a writ of mandate was thereafter signed and entered, and a writ issued commanding the City to revoke all of Beglari's building permits and his certificate of occupancy. The City and Beglari appeal from the judgment.

DISCUSSION

I.
The City and Beglari contend the trial court erred by rejecting substantial evidence in the administrative record that supports the Planning Commission's decision. There are several problems with this contention.
The Evidence. Because the trial court was acting on a petition seeking judicial review of an adjudicatory decision rendered by an administrative agency (Code Civ. Proc., § 1094.5, subd. (e)), the trial court was required to "scrutinize the record and determine whether substantial evidence supports the administrative agency's findings and whether these findings support the agency's decision. In making these determinations, the [trial] court must resolve reasonable doubts in favor of the administrative findings and decision." *302 (Topanga Assn. for a Scenic Community v. County of Los Angeles (1974) 11 Cal.3d 506, 514, 113 Cal.Rptr. 836, 522 P.2d 12.) The "agency" in this case is the Department of Building and Safety, acting first through the Zoning Administrator, then through the Planning Commission, and at all times on behalf of the City of Los Angeles.
All of the evidence was presented to the Zoning Administrator, who ruled in favor of Horwitz. The Planning Commission, which took no new evidence, then ruled in favor of Beglari. It follows that the issue before the trial court was whether the administrative record, in its entirety, contained substantial evidence to support the Planning Commission's decision.[4]
The Law. Issues of law, including the interpretation of the Los Angeles Municipal Code, were before the trial court for de novo review, subject to the well-established rule that the Department's interpretation of the City's Municipal Code is entitled to respect unless that interpretation is clearly erroneous  and the same is true with regard to our review of the trial court's decision. (Terminal Plaza Corp. v. City and County of San Francisco (1986) 186 Cal.App.3d 814, 825-826, 230 Cal.Rptr. 875; and see Yamaha Corp. of America v. State Bd. of Equalization (1998) 19 Cal.4th 1, 8, 78 Cal.Rptr.2d 1, 960 P.2d 1031.)[5]

II.
The City (joined by Beglari) contends the trial court exceeded its authority when it ordered the City to revoke the three permits issued to Beglari. Instead, claims the City, the trial court "should have remanded the matter back to the City to reconsider its action in light of the court's decision, which was to recalculate the front yard setback." This is so, says the City, because Code of Civil Procedure section 1094.5 permits the court to order the City to reconsider its decision and to *303 take further action, but prohibits the court from issuing a writ to "limit or control in any way the discretion legally vested" in the City. (Code Civ. Proc., § 1094.5, subd. (f).) The City's argument misses the point  that (as the Zoning Administrator and the trial court both found) there is no discretion involved in the application of the formula to the measurements at issue in this case.
Beglari's house must conform to the mandatory requirements of the zoning ordinance.[6] As explained above, the remodeled house does not conform because the prevailing front-yard setback was miscalculated by Beglari and mistakenly accepted by the City. Just as the City has no discretion to deny a building permit when an applicant has complied with all applicable ordinances, the City has no discretion to issue a permit in the absence of compliance. (Terminal Plaza Corp. v. City and County San Francisco, supra, 186 Cal.App.3d at pp. 834-835, 230 Cal.Rptr. 875; Gabric v. City of Rancho Palos Verdes (1977) 73 Cal.App.3d 183, 190-192, 140 Cal.Rptr. 619.) It follows that Beglari's permits must be revoked.
It adds nothing to say, as does the City, that remand is necessary to permit it to recalculate the front-yard setback and allow it to then "exercise its discretion to remedy the situation once the proper calculations" are made. While we agree that the proper calculations have to be made, we do not see any basis in law, fact, or fairness to allow the City or Beglari to keep the improperly issued permits in place so that they become the foundation for the decisions that will thereafter have to be made. By parity of reasoning, we reject the City's conclusory assertion that the revocation of Beglari's permits leads "to absurd and inequitable results"  because the City does not say why that is so or why the result would be otherwise if the permits remained in place while the City recalculates the proper front-yard setback. As noted, it seems far more fair and equitable to us to place the burden on Beglari to submit proper permit applications, and to prevent him from retaining some unstated and ephemeral benefit from the nonconforming permits issued in response to his substantially erroneous applications.[7] Under these circumstances, there is only one more thing to be said  that it is time for the City to amend the relevant portions of the Municipal Code.

DISPOSITION
The judgment is affirmed. Horwitz is awarded his costs of appeal.
We concur: SPENCER, P.J., and ALDRICH, J.[*]
NOTES
[1]  Horwitz realized in August 2001 that the construction then underway on Beglari's property appeared to be too close to two streets, Greentree Road and Brooktree Road (Beglari's house is on the corner of those two streets). Horwitz contacted the City by telephone and by letters and tried to determine the basis for the City's authorization of the project. The City at first assured Horwitz that the project had been properly permitted and would comply with all applicable regulations, but later discovered that Beglari's project in fact failed to comply with various ordinances, including the height limitation for the area. At that point, the City gave Beglari the option of reducing the height of his house or raising the site by backfilling a driveway, and Beglari chose the latter option. When Horwitz and the other neighbors were unable to accomplish anything with the City through their informal efforts, they turned to the formal proceedings described in the text.
[2]  As relevant, section 12.07.01 C.1 of the Los Angeles Municipal Code provides: "C. Area. No building or structure nor the enlargement of any building or structure shall be erected or maintained unless the following yards and lot areas are provided and maintained in connection with such building, structure or enlargement: [¶] 1. Front Yard. There shall be a front yard of not less than 20% of the depth of the lot, but such front yard need not exceed 25 feet; provided, however, that where all of the developed lots which have front yards that vary in depth by not more than ten feet comprise 40% or more of the frontage, the minimum front yard depth shall be the average depth of the front yards of each such lot. Where there are two or more possible combinations of developed lots comprising 40% or more of the frontage, each of which has front yards that vary in depth by not more than ten feet, the minimum front yard depth shall be the average depth of the front yards of that combination which has the shallowest average depth...." (Emphasis added.)
[3]  The record does not include a definition of "in line," and it appears to us to be little more than the City's post hoc rationalization for its approval of the faulty information submitted by Beglari.
[4]  The City concedes this point in its opening brief, when it tells us that we "must examine the administrative record to determine whether there is substantial evidence to support the administrative decision and findings," and later that "the administrative decision is upheld if there is any substantial evidence in the record to support the findings." (Emphasis added.)
[5]  The City's theory, that "in line" means the same as "prevailing setback," is pure nonsense  because it would mean there existed two different interpretations of the same language in the ordinance. As Horwitz aptly notes, if "in-line" has any meaning at all, it is as a concept applied to the placement of accessory buildings, not to the determination of front-yard setbacks. And as the Zoning Administrator noted in her decision, the Department staff conceded "that it was not aware of any other situation which would result in a prevailing front yard setback being allowed to be measured to a detached accessory building" which, if allowed, would "establish a new standard citywide for the measurement of prevailing front yard setbacks for lots with similar characteristics." We consider it noteworthy that, in granting Beglari's appeal from the Zoning Administrator's decision, the Planning Commission did not express any disagreement with the Zoning Administrator's findings but seemed to base its decision on a concern that any other result would be unfair to Beglari because he would have to demolish his house. If that is the case, it is an improper basis for the Planning Commission's decision as a matter of law and, possibly, as a matter of fairness. After all, it was Beglari who made the mistake and who refused to pause his construction while this dispute was resolved  and it is Horwitz and the other neighbors who now have a non-conforming house to look at, day in and day out. In any event, the Planning Commission's job is to apply the City's zoning ordinances as written and for the protection of all the residents of the City, not just the permitee. (Terminal Plaza Corp. v. City and County of San Francisco, supra, 186 Cal.App.3d at pp. 834-835, 230 Cal.Rptr. 875.)
[6]  It is for this reason that all of the permits and the certificate of occupancy must be revoked, not just the one authorizing the erroneous front-yard setback. The permit authorizing the backfill of the driveway so the height restriction could be satisfied is invalid because the front of the house and part of the driveway both encroach into the front-yard setback area; the permit authorizing a wall within the side yard is affected because the wall encroaches into the front-yard setback area; and the certificate of occupancy cannot stand without the permits.
[7]  The cases relied on by the City, all of which involved decisions made in the exercise of discretion rather than a rote application of a formula to a set of numbers, are inapposite. (E.g., Fascination, Inc. v. Hoover (1952) 39 Cal.2d 260, 246 P.2d 656 [when a required hearing was not held, the proper remedy was to remand so it could be held and a decision made]; Clark v. City of Hermosa Beach (1996) 48 Cal.App.4th 1152, 56 Cal.Rptr.2d 223 [when a hearing was unfair because of a conflict of interest, the proper remedy is remand for new hearing followed by new decision].)
[*]   Associate Justice of the Court of Appeal, Second Appellate District, assigned by the Chief Justice pursuant to article VI, section 6 of the California Constitution.
