![](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.

## Try the sample

The [GeospatialExample app](https://github.com/google-ar/arcore-ios-sdk/tree/master/Examples/GeospatialExample) demonstrates how to obtain and render Streetscape Geometries.

## 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/ios/geospatial/enable) to set up the Geospatial API.

## Enable Streetscape Geometry

The Geospatial API obtains Streetscape Geometry data when the [`GARGeospatialMode`](https://developers.google.com/ar/reference/ios/group/GARGeospatialMode) is set to [`GARGeospatialModeEnabled`](https://developers.google.com/ar/reference/ios/group/GARGeospatialMode#gargeospatialmodeenabled) and [`GARStreetscapeGeometryMode`](https://developers.google.com/ar/reference/ios/group/GARStreetscapeGeometryMode) is set to [`GARStreetscapeGeometryModeEnabled`](https://developers.google.com/ar/reference/ios/group/GARStreetscapeGeometryMode#garstreetscapegeometrymodeenabled).

    GARSessionConfiguration *configuration = [[GARSessionConfiguration alloc] init];
    configuration.geospatialMode = GARGeospatialModeEnabled;
    configuration.streetscapeGeometryMode = GARStreetscapeGeometryModeEnabled;
    [garSession setConfiguration:configuration error:&error];

## Obtain Streetscape Geometry in an ARCore session

Use [`GARFrame.streetscapeGeometries`](https://developers.google.com/ar/reference/ios/category/GARFrame(Geospatial)#streetscapegeometries) to obtain all [`GARStreetscapeGeometry`](https://developers.google.com/ar/reference/ios/interface/GARStreetscapeGeometry) objects.

<br />

## Understand [`GARStreetscapeGeometry`](https://developers.google.com/ar/reference/ios/interface/GARStreetscapeGeometry)

[`GARStreetscapeGeometry`](https://developers.google.com/ar/reference/ios/interface/GARStreetscapeGeometry) contains information about a building:

- [`GARStreetscapeGeometry.type`](https://developers.google.com/ar/reference/ios/interface/GARStreetscapeGeometry#type)  
  Identifies the StreetscapeGeometry as either terrain or a building.
- [`GARStreetscapeGeometry.mesh`](https://developers.google.com/ar/reference/ios/interface/GARStreetscapeGeometry#mesh)  
  Obtain a polygon [`GARMesh`](https://developers.google.com/ar/reference/ios/interface/GARMesh) that corresponds to this terrain or building.
- [`GARStreetscapeGeometry.meshTransform`](https://developers.google.com/ar/reference/ios/interface/GARStreetscapeGeometry#meshtransform)  
  Describes the origin of the geometry. All points in the [`GARMesh`](https://developers.google.com/ar/reference/ios/interface/GARMesh) should be transformed by [`GARStreetscapeGeometry.meshTransform`](https://developers.google.com/ar/reference/ios/interface/GARStreetscapeGeometry#meshtransform).
- [`GARStreetscapeGeometry.quality`](https://developers.google.com/ar/reference/ios/interface/GARStreetscapeGeometry#quality)  
  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

[`GARStreetscapeGeometryQualityBuildingLOD_1`](https://developers.google.com/ar/reference/ios/group/GARStreetscapeGeometryQuality#garstreetscapegeometryqualitybuildinglod_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

[`GARStreetscapeGeometryQualityBuildingLOD_2`](https://developers.google.com/ar/reference/ios/group/GARStreetscapeGeometryQuality#garstreetscapegeometryqualitybuildinglod_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 [`GARMesh`](https://developers.google.com/ar/reference/ios/interface/GARMesh)

[`GARMesh`](https://developers.google.com/ar/reference/ios/interface/GARMesh) is a polygon mesh representing a surface reconstruction of the Streetscape Geometry.

Each [`GARMesh`](https://developers.google.com/ar/reference/ios/interface/GARMesh) includes a vertex buffer and index buffer:

- [`GARMesh.vertexCount`](https://developers.google.com/ar/reference/ios/interface/GARMesh#vertexcount)  
  Retrieves the number of vertices in this mesh.
- [`GARMesh.vertices`](https://developers.google.com/ar/reference/ios/interface/GARMesh#vertices)  
  Obtain the concatenated positions of mesh vertices, in coordinates relative to [`GARStreetscapeGeometry.meshTransform`](https://developers.google.com/ar/reference/ios/interface/GARStreetscapeGeometry#meshtransform).
- [`GARMesh.triangleCount`](https://developers.google.com/ar/reference/ios/interface/GARMesh#trianglecount)  
  Retrieves the number of indices in this mesh.
- [`GARMesh.triangles`](https://developers.google.com/ar/reference/ios/interface/GARMesh#triangles)  
  Obtain the indexes of vertices that make up a face.

## Attach AR content to a [`GARStreetscapeGeometry`](https://developers.google.com/ar/reference/ios/interface/GARStreetscapeGeometry)

Use [`GARSesssion.createAnchorOnStreetscapeGeometry:transform:error:`](https://developers.google.com/ar/reference/ios/category/GARSession(Geospatial)#createanchoronstreetscapegeometry:transform:error:) to create an anchor at a given pose near [`GARStreetscapeGeometry.meshTransform`](https://developers.google.com/ar/reference/ios/interface/GARStreetscapeGeometry#meshtransform). This anchor will inherit its tracking state from the parent [`GARStreetscapeGeometry`](https://developers.google.com/ar/reference/ios/interface/GARStreetscapeGeometry).

<br />

### Perform a hit-test against [`GARStreetscapeGeometry`](https://developers.google.com/ar/reference/ios/interface/GARStreetscapeGeometry)

[`GARSession.raycastStreetscapeGeometry:direction:error:`](https://developers.google.com/ar/reference/ios/category/GARSession(Geospatial)#raycaststreetscapegeometry:direction:error:) can be used to hit-test against Streetscape Geometry. If intersections are found, [`GARStreetscapeGeometryRaycastResult`](https://developers.google.com/ar/reference/ios/interface/GARStreetscapeGeometryRaycastResult) contains pose information about the hit location as well as a reference to the [`GARStreetscapeGeometry`](https://developers.google.com/ar/reference/ios/interface/GARStreetscapeGeometry) which was hit. This Streetscape Geometry can be passed to [`GARSesssion.createAnchorOnStreetscapeGeometry:transform:error:`](https://developers.google.com/ar/reference/ios/category/GARSession(Geospatial)#createanchoronstreetscapegeometry:transform:error:) to create an anchor attached to it.

    NSArray<GARStreetscapeGeometryRaycastResult *> *results =
        [session raycastStreetscapeGeometry:arRaycastQuery.origin
                                  direction:arRaycastQuery.direction
                                      error:&error];
    [session createAnchorOnStreetscapeGeometry:results[0].streetscapeGeometry
                                     transform:results[0].worldTransform
                                         error:&error];