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 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 to set up the Geospatial API.
Enable Streetscape Geometry
GARSessionConfiguration *configuration = [[GARSessionConfiguration alloc] init]; configuration.geospatialMode = GARGeospatialModeEnabled; configuration.streetscapeGeometryMode = GARStreetscapeGeometryModeEnabled; [garSession setConfiguration:configuration error:&error];
Obtain Streetscape Geometry in an ARCore sessionUse
GARFrame.streetscapeGeometriesto obtain all
GARStreetscapeGeometry contains information about a building:
Identifies the StreetscapeGeometry as either terrain or a building.
Obtain a polygon
GARMeshthat corresponds to this terrain or building.
Describes the origin of the geometry. All points in the
GARMeshshould be transformed by
Provides the quality of the mesh data. Levels of detail are described in the CityGML 2.0 standard.
Building LOD 1
GARStreetscapeGeometryQualityBuildingLOD_1 consists of building footprints extruded upwards to a flat top. Building heights may be inaccurate.
Building LOD 2
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.
Retrieves the number of vertices in this mesh.
Obtain the concatenated positions of mesh vertices, in coordinates relative to
Retrieves the number of indices in this mesh.
Obtain the indexes of vertices that make up a face.
Attach AR content to a
GARSesssion.createAnchorOnStreetscapeGeometry:transform:error:to create an anchor at a given pose near
GARStreetscapeGeometry.meshTransform. This anchor will inherit its tracking state from the parent
Perform a hit-test against
GARSession.raycastStreetscapeGeometry:direction:error: can be used to hit-test against Streetscape Geometry. If intersections are found,
GARStreetscapeGeometryRaycastResult contains pose information about the hit location as well as a reference to the
GARStreetscapeGeometry which was hit. This Streetscape Geometry can be passed to
GARSesssion.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.streetscapeGeometry transform:results.worldTransform error:&error];