Use buildings and terrain around you on Android NDK (C)
Stay organized with collectionsSave and categorize content based on your preferences.
The Streetscape Geometry APIs provide the geometry of terrain, buildings, or other structures in a scene. The geometry can be used for occlusion, rendering, or placing AR content via hit-test APIs. Streetscape Geometry data is obtained through Google Street View imagery.
Set up the Geospatial API
To use Streetscape Geometry, you'll need to set up the Geospatial API in your project.
Follow instructions onEnabling the Geospatial APIto set up the Geospatial API.
AR_STREETSCAPE_GEOMETRY_QUALITY_BUILDING_LOD_2will have higher fidelity geometry. Mesh walls and roofs will more closely match the building's shape. Smaller features like chimneys or roof vents may still poke outside of the mesh.
ArFrame_hitTestcan be used to hit-test against Streetscape Geometry. If intersections are found,ArHitResultcontains pose information about the hit location as well as a reference to theArStreetscapeGeometrywhich was hit. This Streetscape Geometry can be passed toArTrackable_acquireNewAnchor()to create an anchor attached to it.
Geospatial Depthcombines Streetscape Geometry
with local sensor input to enhance depth data. When Geospatial Depth is enabled,
the output depth and raw depth images are modified to include rasterized Streetscape Geometry in addition to locally observed depth.
This may improve the accuracy of poses using Depth.
[[["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-14 UTC."],[[["\u003cp\u003eThe Streetscape Geometry APIs offer terrain and building geometry from Google Street View for occlusion, rendering, and AR content placement.\u003c/p\u003e\n"],["\u003cp\u003eTo utilize this feature, enable the Geospatial and Streetscape Geometry modes in your ARCore session configuration.\u003c/p\u003e\n"],["\u003cp\u003eYou can access Streetscape Geometry data using \u003ccode\u003eArSession_getAllTrackables()\u003c/code\u003e and filter the results by \u003ccode\u003eAR_TRACKABLE_STREETSCAPE_GEOMETRY\u003c/code\u003e to obtain \u003ccode\u003eArStreetscapeGeometry\u003c/code\u003e objects, which include mesh and quality details.\u003c/p\u003e\n"],["\u003cp\u003eTwo methods exist for attaching AR content: using Geospatial Depth and Depth hit-test (recommended), or creating anchors directly on \u003ccode\u003eArStreetscapeGeometry\u003c/code\u003e using \u003ccode\u003eArTrackable_acquireNewAnchor()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eHit-testing against Streetscape Geometry allows interaction and anchor placement, enabling you to align and integrate virtual objects with the real-world environment.\u003c/p\u003e\n"]]],["Streetscape Geometry APIs provide data on terrain and building structures, sourced from Google Street View, for occlusion, rendering, or AR content placement. To utilize this, enable the Geospatial API and set `ArGeospatialMode` and `ArStreetscapeGeometryMode` to enabled. Retrieve geometry using `ArSession_getAllTrackables()`. Each geometry includes type, mesh, origin, and quality data. `ArMesh` details vertex and index buffers. Content can be attached through Geospatial Depth or anchors. Hit-testing against geometry is possible via `ArFrame_hitTest`, and Geospatial Depth enhances depth data.\n"],null,["# Use buildings and terrain around you on Android NDK (C)\n\nThe Streetscape Geometry APIs provide the geometry of terrain, buildings, or other structures in a scene. The geometry can be used for occlusion, rendering, or placing AR content via hit-test APIs. Streetscape Geometry data is obtained through Google Street View imagery.\n\nSet up the Geospatial API\n-------------------------\n\nTo use Streetscape Geometry, you'll need to set up the Geospatial API in your project.\nFollow instructions on [Enabling the Geospatial API](/ar/develop/c/geospatial/enable) to set up the Geospatial API.\n\nEnable Streetscape Geometry\n---------------------------\n\nThe Geospatial API obtains Streetscape Geometry data when the [`ArGeospatialMode`](/ar/reference/c/group/ar-config#argeospatialmode) is set to [`ArGeospatialModeEnabled`](/ar/reference/c/group/ar-config#ar_geospatial_mode_enabled) and [`ArStreetscapeGeometryMode`](/ar/reference/c/group/ar-config#arstreetscapegeometrymode) is set to [`ArStreetscapeGeometryModeEnabled`](/ar/reference/c/group/ar-config#ar_streetscape_geometry_mode_enabled). \n\n```c\n// Create a session config.\nArConfig* ar_config = NULL;\nArConfig_create(ar_session, &ar_config);\n\n// Enable the Geospatial API.\nArConfig_setGeospatialMode(ar_session, ar_config, AR_GEOSPATIAL_MODE_ENABLED);\nCHECK(ArSession_configure(ar_session, ar_config) == AR_SUCCESS);\n\n// Enable Streetscape Geometry.\nArConfig_setStreetscapeGeometryMode(ar_session, ar_config, AR_STREETSCAPE_GEOMETRY_MODE_ENABLED);\nCHECK(ArSession_configure(ar_session, ar_config) == AR_SUCCESS);\n\n// Release config resources.\nArConfig_destroy(ar_config);\n```\n\nObtain Streetscape Geometry in an ARCore session\n------------------------------------------------\n\nUse [`ArSession_getAllTrackables()`](/ar/reference/c/group/ar-session#arsession_getalltrackables) and use [`AR_TRACKABLE_STREETSCAPE_GEOMETRY`](/ar/reference/c/group/ar-trackable#ar_trackable_streetscape_geometry) to filter results.\n\n\u003cbr /\u003e\n\n```c\nArTrackableList* trackable_list = NULL;\nArTrackableList_create(ar_session, &trackable_list);\nArSession_getAllTrackables(ar_session, AR_TRACKABLE_STREETSCAPE_GEOMETRY, trackable_list);\n```\n\nUnderstand [`ArStreetscapeGeometry`](/ar/reference/c/group/ar-streetscape-geometry)\n-----------------------------------------------------------------------------------\n\n[`ArStreetscapeGeometry`](/ar/reference/c/group/ar-streetscape-geometry) contains information about a building:\n\n- [`ArStreetscapeGeometry_getType()`](/ar/reference/c/group/ar-streetscape-geometry#arstreetscapegeometry_gettype) \n Identifies the StreetscapeGeometry as either terrain or a building.\n- [`ArStreetscapeGeometry_acquireMesh()`](/ar/reference/c/group/ar-streetscape-geometry#arstreetscapegeometry_acquiremesh) \n Obtain a polygon [`ArMesh`](/ar/reference/c/group/ar-mesh) that corresponds to this terrain or building.\n- [`ArStreetscapeGeometry_getMeshPose()`](/ar/reference/c/group/ar-streetscape-geometry#arstreetscapegeometry_getmeshpose) \n Describes the origin of the geometry. All points in the [`ArMesh`](/ar/reference/c/group/ar-mesh) should be transformed by [`ArStreetscapeGeometry_getMeshPose()`](/ar/reference/c/group/ar-streetscape-geometry#arstreetscapegeometry_getmeshpose).\n- [`ArStreetscapeGeometry_getQuality()`](/ar/reference/c/group/ar-streetscape-geometry#arstreetscapegeometry_getquality) \n Provides the quality of the mesh data. Levels of detail are described in the [CityGML 2.0 standard](https://portal.ogc.org/files/?artifact_id=16675).\n\n### Building LOD 1\n\n[`AR_STREETSCAPE_GEOMETRY_QUALITY_BUILDING_LOD_1`](/ar/reference/c/group/ar-streetscape-geometry#ar_streetscape_geometry_quality_building_lod_1) consists of building footprints extruded upwards to a flat top. Building heights may be inaccurate.\n\n### Building LOD 2\n\n[`AR_STREETSCAPE_GEOMETRY_QUALITY_BUILDING_LOD_2`](/ar/reference/c/group/ar-streetscape-geometry#ar_streetscape_geometry_quality_building_lod_2) will have higher fidelity geometry. Mesh walls and roofs will more closely match the building's shape. Smaller features like chimneys or roof vents may still poke outside of the mesh.\n\nUnderstand [`ArMesh`](/ar/reference/c/group/ar-mesh)\n----------------------------------------------------\n\n[`ArMesh`](/ar/reference/c/group/ar-mesh) is a polygon mesh representing a surface reconstruction of the Streetscape Geometry.\n\nEach [`ArMesh`](/ar/reference/c/group/ar-mesh) includes a vertex buffer and index buffer:\n\n- [`ArMesh_getVertexListSize()`](/ar/reference/c/group/ar-mesh#armesh_getvertexlistsize) \n Retrieves the number of vertices in this mesh.\n- [`ArMesh_getVertexList()`](/ar/reference/c/group/ar-mesh#armesh_getvertexlist) \n Obtain the concatenated positions of mesh vertices, in coordinates relative to [`ArStreetscapeGeometry_getMeshPose()`](/ar/reference/c/group/ar-streetscape-geometry#arstreetscapegeometry_getmeshpose).\n- [`ArMesh_getIndexListSize()`](/ar/reference/c/group/ar-mesh#armesh_getindexlistsize) \n Retrieves the number of indices in this mesh.\n- [`ArMesh_getIndexList()`](/ar/reference/c/group/ar-mesh#armesh_getindexlist) \n Obtain the indexes of vertices that make up a face.\n\nAttach AR content to a [`ArStreetscapeGeometry`](/ar/reference/c/group/ar-streetscape-geometry)\n-----------------------------------------------------------------------------------------------\n\nThere are two ways to attach AR content to Streetscape Geometry:\n\n\u003cbr /\u003e\n\n- Enable [Geospatial Depth](/ar/develop/c/depth/geospatial-depth) and use a [Depth hit-test](/ar/develop/c/depth/developer-guide#depth_hit-test). This is the recommended and easier method.\n- Use [`ArTrackable_acquireNewAnchor()`](/ar/reference/c/group/ar-trackable#artrackable_acquirenewanchor) to create an anchor at a given pose attached to a [`ArStreetscapeGeometry`](/ar/reference/c/group/ar-streetscape-geometry). This anchor will inherit its tracking state from the parent [`ArStreetscapeGeometry`](/ar/reference/c/group/ar-streetscape-geometry).\n\n### Perform a hit-test against [`ArStreetscapeGeometry`](/ar/reference/c/group/ar-streetscape-geometry)\n\n[`ArFrame_hitTest`](/ar/reference/c/group/ar-frame#arframe_hittest) can be used to hit-test against Streetscape Geometry. If intersections are found, [`ArHitResult`](/ar/reference/c/group/ar-hit-result) contains pose information about the hit location as well as a reference to the [`ArStreetscapeGeometry`](/ar/reference/c/group/ar-streetscape-geometry) which was hit. This Streetscape Geometry can be passed to [`ArTrackable_acquireNewAnchor()`](/ar/reference/c/group/ar-trackable#artrackable_acquirenewanchor) to create an anchor attached to it. \n\n```c\nArHitResultList *hit_result_list = NULL;\nArHitResult *hit_result = NULL;\nArHitResultList_create(ar_session, &hit_result_list);\nArHitResult_create(ar_session, &hit_result);\n\nArFrame_hitTestRay(ar_session, ar_frame, origin, direction, hit_result_list);\nArHitResultList_getItem(ar_session, hit_result_list, 0, hit_result);\n\nArAnchor *out_anchor = NULL;\nArStatus status = ArHitResult_acquireNewAnchor(ar_session, hit_result, &out_anchor);\nCHECK(status == AR_SUCCESS);\n```\n\nEnable Geospatial Depth\n-----------------------\n\n[Geospatial Depth](/ar/develop/c/depth/geospatial-depth) combines Streetscape Geometry\nwith local sensor input to enhance depth data. When Geospatial Depth is enabled,\nthe output depth and raw depth images are modified to include rasterized Streetscape Geometry in addition to locally observed depth.\nThis may improve the accuracy of poses using Depth."]]