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.
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 typesBuilding
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 detailsYou 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
.
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:
place_id
The unique identifier of the building. See the Place IDs overview for more details.
building_outlines[]
An array of outlines associated with the building. This array has only one entry. Each object in building_outlines[]
has the following field:
display_polygon
The GeoJSON encoding of the polygon that approximates the surface area of the earth covered by the building, using the RFC 7946 format
display_polygon
object can represent multiple polygons.
An entrances[]
array with the following fields:
location
Latitude/longitude coordinates of the entrance.
building_place_id
The place ID of the building in buildings[]
that contains this entrance. This lets you identify which buildings contain which entrances. This entrance corresponds to the building at index i
in buildings[]
where buildings[i].place_id
equals this entrance's building_place_id
. Note: This value is different from the place ID of the geocode result, unless the geocode result is for the building itself. This parameter won't always be populated.
entrance_tags[]
An array of entrance tags that describes characteristics of the entrance. The following value is supported:
"PREFERRED"
Indicates this entrance likely provides physical access to the returned place. A place can have multiple preferred entrances. If an entrance does not have this tag, it means the entrance is physically on the same building but does not necessarily provide access to the place.
For example, if the returned place is a restaurant in a strip mall, the "PREFERRED"
entrances will be the ones that lead into the restaurant itself, while the other returned entrances will be other entrances for the building, such as entrances into other restaurants in the strip mall.
If the returned place is a building itself, the "PREFERRED"
entrances will be the ones that lead into the "main" part of the building. For example, in a shopping center the "PREFERRED"
entrances will be the ones that allow access to the main foyer area, but if an entrance only provides access to a store on the side of the building, it won't be a "PREFERRED"
entrance.
"PREFERRED"
entrance might not provide access to the returned place, and a non-preferred might provide access to the returned place.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:
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 outlinesYou might also encounter the following situations; however, the above sample code will still work for these:
building_outlines
object representing multiple polygons.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:
FeedbackThis 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