![](https://developers.google.com/static/ar/develop/geospatial/images/hero-streetscape-geometry-eiffel-tower.jpg)

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 on [Enabling the Geospatial API](https://developers.google.com/ar/develop/c/geospatial/enable) to set up the Geospatial API.

## Enable Streetscape Geometry

The Geospatial API obtains Streetscape Geometry data when the [`ArGeospatialMode`](https://developers.google.com/ar/reference/c/group/ar-config#argeospatialmode) is set to [`ArGeospatialModeEnabled`](https://developers.google.com/ar/reference/c/group/ar-config#ar_geospatial_mode_enabled) and [`ArStreetscapeGeometryMode`](https://developers.google.com/ar/reference/c/group/ar-config#arstreetscapegeometrymode) is set to [`ArStreetscapeGeometryModeEnabled`](https://developers.google.com/ar/reference/c/group/ar-config#ar_streetscape_geometry_mode_enabled).

```c
// Create a session config.
ArConfig* ar_config = NULL;
ArConfig_create(ar_session, &ar_config);

// Enable the Geospatial API.
ArConfig_setGeospatialMode(ar_session, ar_config, AR_GEOSPATIAL_MODE_ENABLED);
CHECK(ArSession_configure(ar_session, ar_config) == AR_SUCCESS);

// Enable Streetscape Geometry.
ArConfig_setStreetscapeGeometryMode(ar_session, ar_config, AR_STREETSCAPE_GEOMETRY_MODE_ENABLED);
CHECK(ArSession_configure(ar_session, ar_config) == AR_SUCCESS);

// Release config resources.
ArConfig_destroy(ar_config);
```

## Obtain Streetscape Geometry in an ARCore session

Use [`ArSession_getAllTrackables()`](https://developers.google.com/ar/reference/c/group/ar-session#arsession_getalltrackables) and use [`AR_TRACKABLE_STREETSCAPE_GEOMETRY`](https://developers.google.com/ar/reference/c/group/ar-trackable#ar_trackable_streetscape_geometry) to filter results.

<br />

```c
ArTrackableList* trackable_list = NULL;
ArTrackableList_create(ar_session, &trackable_list);
ArSession_getAllTrackables(ar_session, AR_TRACKABLE_STREETSCAPE_GEOMETRY, trackable_list);
```

## Understand [`ArStreetscapeGeometry`](https://developers.google.com/ar/reference/c/group/ar-streetscape-geometry)

[`ArStreetscapeGeometry`](https://developers.google.com/ar/reference/c/group/ar-streetscape-geometry) contains information about a building:

- [`ArStreetscapeGeometry_getType()`](https://developers.google.com/ar/reference/c/group/ar-streetscape-geometry#arstreetscapegeometry_gettype)  
  Identifies the StreetscapeGeometry as either terrain or a building.
- [`ArStreetscapeGeometry_acquireMesh()`](https://developers.google.com/ar/reference/c/group/ar-streetscape-geometry#arstreetscapegeometry_acquiremesh)  
  Obtain a polygon [`ArMesh`](https://developers.google.com/ar/reference/c/group/ar-mesh) that corresponds to this terrain or building.
- [`ArStreetscapeGeometry_getMeshPose()`](https://developers.google.com/ar/reference/c/group/ar-streetscape-geometry#arstreetscapegeometry_getmeshpose)  
  Describes the origin of the geometry. All points in the [`ArMesh`](https://developers.google.com/ar/reference/c/group/ar-mesh) should be transformed by [`ArStreetscapeGeometry_getMeshPose()`](https://developers.google.com/ar/reference/c/group/ar-streetscape-geometry#arstreetscapegeometry_getmeshpose).
- [`ArStreetscapeGeometry_getQuality()`](https://developers.google.com/ar/reference/c/group/ar-streetscape-geometry#arstreetscapegeometry_getquality)  
  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).

### Building LOD 1

[`AR_STREETSCAPE_GEOMETRY_QUALITY_BUILDING_LOD_1`](https://developers.google.com/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.

![](https://developers.google.com/static/ar/develop/images/streetscape-geometry-lod1.png)

### Building LOD 2

[`AR_STREETSCAPE_GEOMETRY_QUALITY_BUILDING_LOD_2`](https://developers.google.com/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.

![](https://developers.google.com/static/ar/develop/images/streetscape-geometry-lod2.png)

## Understand [`ArMesh`](https://developers.google.com/ar/reference/c/group/ar-mesh)

[`ArMesh`](https://developers.google.com/ar/reference/c/group/ar-mesh) is a polygon mesh representing a surface reconstruction of the Streetscape Geometry.

Each [`ArMesh`](https://developers.google.com/ar/reference/c/group/ar-mesh) includes a vertex buffer and index buffer:

- [`ArMesh_getVertexListSize()`](https://developers.google.com/ar/reference/c/group/ar-mesh#armesh_getvertexlistsize)  
  Retrieves the number of vertices in this mesh.
- [`ArMesh_getVertexList()`](https://developers.google.com/ar/reference/c/group/ar-mesh#armesh_getvertexlist)  
  Obtain the concatenated positions of mesh vertices, in coordinates relative to [`ArStreetscapeGeometry_getMeshPose()`](https://developers.google.com/ar/reference/c/group/ar-streetscape-geometry#arstreetscapegeometry_getmeshpose).
- [`ArMesh_getIndexListSize()`](https://developers.google.com/ar/reference/c/group/ar-mesh#armesh_getindexlistsize)  
  Retrieves the number of indices in this mesh.
- [`ArMesh_getIndexList()`](https://developers.google.com/ar/reference/c/group/ar-mesh#armesh_getindexlist)  
  Obtain the indexes of vertices that make up a face.

## Attach AR content to a [`ArStreetscapeGeometry`](https://developers.google.com/ar/reference/c/group/ar-streetscape-geometry)

There are two ways to attach AR content to Streetscape Geometry:

<br />

- Enable [Geospatial Depth](https://developers.google.com/ar/develop/c/depth/geospatial-depth) and use a [Depth hit-test](https://developers.google.com/ar/develop/c/depth/developer-guide#depth_hit-test). This is the recommended and easier method.
- Use [`ArTrackable_acquireNewAnchor()`](https://developers.google.com/ar/reference/c/group/ar-trackable#artrackable_acquirenewanchor) to create an anchor at a given pose attached to a [`ArStreetscapeGeometry`](https://developers.google.com/ar/reference/c/group/ar-streetscape-geometry). This anchor will inherit its tracking state from the parent [`ArStreetscapeGeometry`](https://developers.google.com/ar/reference/c/group/ar-streetscape-geometry).

### Perform a hit-test against [`ArStreetscapeGeometry`](https://developers.google.com/ar/reference/c/group/ar-streetscape-geometry)

[`ArFrame_hitTest`](https://developers.google.com/ar/reference/c/group/ar-frame#arframe_hittest) can be used to hit-test against Streetscape Geometry. If intersections are found, [`ArHitResult`](https://developers.google.com/ar/reference/c/group/ar-hit-result) contains pose information about the hit location as well as a reference to the [`ArStreetscapeGeometry`](https://developers.google.com/ar/reference/c/group/ar-streetscape-geometry) which was hit. This Streetscape Geometry can be passed to [`ArTrackable_acquireNewAnchor()`](https://developers.google.com/ar/reference/c/group/ar-trackable#artrackable_acquirenewanchor) to create an anchor attached to it.

```c
ArHitResultList *hit_result_list = NULL;
ArHitResult *hit_result = NULL;
ArHitResultList_create(ar_session, &hit_result_list);
ArHitResult_create(ar_session, &hit_result);

ArFrame_hitTestRay(ar_session, ar_frame, origin, direction, hit_result_list);
ArHitResultList_getItem(ar_session, hit_result_list, 0, hit_result);

ArAnchor *out_anchor = NULL;
ArStatus status = ArHitResult_acquireNewAnchor(ar_session, hit_result, &out_anchor);
CHECK(status == AR_SUCCESS);
```

## Enable Geospatial Depth

[Geospatial Depth](https://developers.google.com/ar/develop/c/depth/geospatial-depth) combines 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.