A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developers.google.com/maps/documentation/geocoding/building-attributes below:

Building outlines and entrances | Geocoding API

Skip to main content Building outlines and entrances

Stay organized with collections Save and categorize content based on your preferences.

This product or feature is Experimental (pre-GA). Pre-GA products and features might have limited support, and changes to pre-GA products and features might not be compatible with other pre-GA versions. Pre-GA Offerings are covered by the Google Maps Platform Service Specific Terms. For more information, see the launch stage descriptions.

Use the Geocoding API to get building outlines and entrances to enhance data visualization in your map renderings.

To do this, include an additional parameter in your Geocoding request to return latitude/longitude coordinate pairs that either define a building outline, or an entrance. Use the output of your requests to draw building outlines and indicate building entrances on your map.

Usage & coverage

You can use the service to return outline polygons for a single place in a single request. This means that a request for a city-level geocode, such as London, UK, does not return all building outlines within that locality. In such cases, the service would return a standard geocoding response with no building outlines or entrances. Specifically, the service generates outlines and entrances only for the following place types:

Supported place types

Building

Entrances

premise

premise

subpremise

subpremise

point_of_interest

point_of_interest

street_address

While this feature is available to use in all regions, coverage varies by region. Furthermore, you should expect to receive API responses that contain a building outline, but no entrance data. In this case, the service will return a geocoding response with a building outline, but no entrance data array. The service continually works to improve entrance coverage.

Request details

You can obtain building outlines and entrance coordinates in the following kinds of requests:

For any of these requests, you supply this parameter: extra_computations=BUILDING_AND_ENTRANCES.

Example request

The following query uses place geocoding to obtain entrance and outline information for a restaurant in Mountain View, California, United States:

https://maps.googleapis.com/maps/api/geocode/json?place_id=ChIJl2tj2-62j4ARzKWl1WCXLJI&extra_computations=BUILDING_AND_ENTRANCES&key=YOUR_API_KEY
Example response

In most cases, the response returns a single building along with the known entrances of the building. But in some cases, the response can have multiple buildings, such as points of interest that occupy multiple buildings. The buildings and entrances are represented with the following two arrays:

A buildings[] array with one or more buildings. Each building contains the following fields:

Note: The RFC 7946 format supports MultiPolygons, so one display_polygon object can represent multiple polygons.

An entrances[] array with the following fields:

The image below shows a visual representation of the building outline and entrances returned for the example request above.

The response from the example request above shows two entrances and a single building with an outline. Notice that the building_place_id of each entrance matches the place_id of the building:

{
  "entrances": [
    {
        "building_place_id" : "ChIJU1erIO-2j4ARzlavxpYBJr8",
        "location" :
        {
          "lat" : 37.3736684,
          "lng" : -122.0540469
        },
        "entrance_tags": ["PREFERRED"]
    },
    {
        "building_place_id" : "ChIJU1erIO-2j4ARzlavxpYBJr8",
        "location" :
        {
          "lat" : 37.3738239,
          "lng" : -122.0539773
        },
    }
  ],
  "buildings" : [
    {
      "building_outlines" : [
        {
          "display_polygon" : {
            "coordinates" : [
              [
                [
                  -122.054453349467,
                  37.3742345734776
                ],
                [
                  -122.054665964955,
                  37.3737591984554
                ],
                [
                  -122.054080317537,
                  37.3735936952922
                ],
                [
                  -122.053867527481,
                  37.374069124071
                ],
                [
                  -122.054453349467,
                  37.3742345734776
                ]
              ]
            ],
            "type" : "Polygon"
          }
        }
      ],
      "place_id" : "ChIJU1erIO-2j4ARzlavxpYBJr8"
    }
  ],
}
Display building outlines on a map

The JavaScript API has built-in support for displaying RFC 7946 format Polygons and MultiPolygons . You do this as follows:

  1. Build a feature object using the polygon data.
  2. Apply a style to the polygon.
  3. Attach the feature to the JavaScript map object.

Every object in the buildings array contains a single object in the building_outlines array. The following example shows how to display a building outline on a map:

//This function takes an argument of 'buildings', which is the buildings[] array returned by the API.
async function displayBuildingOutline(buildings) {
    try {
        //Import the Google Maps Data library.
        const { Data } = await google.maps.importLibrary("maps")
        //Loop though the array of building outlines.
        buildings.forEach(building => {
            const features = []
            const buildingOutlines = building.building_outlines;
            //Add each building outline to a Feature object, and push this to an array of Features.
            buildingOutlines.forEach(buildingOutline => {
                const feature = {
                    type: "Feature",
                    properties: {},
                    geometry: buildingOutline.display_polygon
                }
                features.push(feature);
            });
            //Create a new Google Maps Data object, and apply styling.
            //We also assume the reference to the map on the page is named 'map'.
            //This applies the Data object to the map on the page.
            outlineLayer = new google.maps.Data({
                map,
                style: {
                    strokeColor: "#0085cc",
                    strokeOpacity: 1,
                    strokeWeight: 2,
                    fillColor: "#88d4fc",
                    fillOpacity: 0.5,
                },
            });
            //Add the array of Features created earlier to the Data object, as GeoJson.
            outlineLayer.addGeoJson({
                type: "FeatureCollection",
                features: features,
            });
        });
    } catch (e) {
        console.log('Building outlines failed. Error: ' + e)
    }
}

Using the code above, the building outline returned by the Geocoding API within the example response earlier in this document is rendered on the map as follows:

Handle responses with multiple buildings or building outlines

You might also encounter the following situations; however, the above sample code will still work for these:

  1. A single building_outlines object representing multiple polygons.
  2. A response with multiple buildings in the buildings[] array.

For example, the response for the place ID ChIJGxgH9QBVHBYRl13JmZ0BFgo contains two buildings in the buildings[] array:

"buildings": [
    {
        "building_outlines": [
            {
                "display_polygon": {
                    "coordinates": [
                        [
                            [
                                44.3313253363354,
                                13.636033631612
                            ],
                            [
                                44.3312576355624,
                                13.6362094887862
                            ],
                            [
                                44.3310854239923,
                                13.6361461767801
                            ],
                            [
                                44.3311531250111,
                                13.6359703194634
                            ],
                            [
                                44.3313253363354,
                                13.636033631612
                            ]
                        ]
                    ],
                    "type": "Polygon"
                }
            }
        ],
        "place_id": "ChIJ24NWUBhUHBYRSEmPBFa1wgc"
    },
    {
        "building_outlines": [
            {
                "display_polygon": {
                    "coordinates": [
                        [
                            [
                                44.330737534504,
                                13.6357057440832
                            ],
                            [
                                44.3307248314371,
                                13.6357390350529
                            ],
                            [
                                44.3306985591742,
                                13.635729486373
                            ],
                            [
                                44.3307114066013,
                                13.6356960265536
                            ],
                            [
                                44.330737534504,
                                13.6357057440832
                            ]
                        ]
                    ],
                    "type": "Polygon"
                }
            }
        ],
        "place_id": "ChIJpzQOABlUHBYRxiOC9goY1fE"
    }
]

Using the JavaScript code sample above, we are able to render both building outlines on the map:

Feedback

This is an experimental feature. We would appreciate feedback at geocoding-feedback-channel@google.com.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-07-09 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-09 UTC."],[[["Enhance map visualizations with building outlines and entrances using the Geocoding API by including the `extra_computations=BUILDING_AND_ENTRANCES` parameter in requests."],["Building outlines are sets of latitude/longitude coordinates defining a building's footprint, while entrances are single coordinate pairs marking entry/exit points."],["The feature supports specific place types like `premise`, `subpremise`, `point_of_interest`, and `street_address`, with varying coverage and ongoing entrance data improvements."],["The Geocoding API response includes `buildings[]` and `entrances[]` arrays containing outline polygons and entrance locations, respectively."],["Utilize the JavaScript API to display building outlines on a map by constructing feature objects from polygon data and applying them to the map."]]],["The Geocoding API can now return building outlines and entrance data for enhanced map visualization. To obtain this data, use the `extra_computations=BUILDING_AND_ENTRANCES` parameter in Geocoding, Reverse Geocoding, or Place Geocoding requests for supported place types such as `premise` and `street_address`. Responses include `buildings[]` with `building_outlines[]` (GeoJSON polygon coordinates) and `entrances[]` (latitude/longitude pairs). A JavaScript API example demonstrates rendering building outlines on a map, handling single and multiple building outlines. This feature is experimental, with varying coverage by region.\n"]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4