Introduction
Geolocation allows Matterport Spaces to be mapped to real world locations by latitude, longitude, and altitute.
Determining Geolocation can be difficult in indoor environments and is determined by a combination of different factors including hardware GPS and software-based mapping tools that are forthcoming.
Our GeoCoordinates API provides an interface for accessing geolocation data that is associated with a model as well as the source of the data (processing, client, unknown) and a translation from the associated GPS and the origin of a model (0,0,0).
Users can also use their own methods to patch the geolocation data associated with a model.
Sample Queries
Get GeoCoordinates Information for a Model
query getGeoCoordinates($modelId: ID!) {
model(id: $modelId) {
id
geocoordinates {
... GeoCoordinateFragment
}
}
}
fragment GeoCoordinateFragment on GeoCoordinate {
source
altitude
latitude
longitude
translation { x y z }
rotation { x y z w }
}
Variable Arguments:
{
"modelId": "[YOUR MODEL ID]"
}
Sample Response:
{
"data": {
"model": {
"id": "DpFVgQXVTmD",
"geocoordinates": {
"source": "processing",
"altitude": 0,
"latitude": 33.276006298034105,
"longitude": -96.80354127176122,
"translation": {
"x": 0.3076627708815243,
"y": 3.3566522639732987,
"z": 0
},
"rotation": {
"x": 0,
"y": 0,
"z": -0.3681099881862502,
"w": 0.929782252249159
}
}
}
}
}
Get GeoCoordinates for a Point within in a Model
Sample Query:
query getGeoLocationOf($modelId: ID!, $point: IPoint3D!) {
model(id: $modelId) {
id
geocoordinates {
geoLocationOf(modelLocation: $point) {
lat
long
}
}
}
}
Variable Arguments:
{
"modelId": "[YOUR MODEL ID]]",
"point": {
"x": 3.11,
"y": 3.14,
"z": 5.4
}
}
Sample Response:
{
"data": {
"model": {
"id": "[YOUR MODEL ID]]",
"geocoordinates": {
"geoLocationOf": {
"lat": "33.27603743078501",
"long": "-96.8034845051858"
}
}
}
}
}
Translate GeoCoordinates to Model Coordinates
Sample Query:
query getModelLocationOf($modelId: ID!, $lat: Float!, $lon: Float!) {
model(id: $modelId) {
id
geocoordinates {
modelLocationOf(
latitude: $lat,
longitude: $lon,
) { x y z }
}
}
}
Variable Arguments:
{
"modelId": "[YOUR MODEL ID]",
"lat": 33.27603743078501,
"lon": -96.8034845051858
}
Sample Response:
{
"data": {
"model": {
"id": "[YOUR MODEL ID]",
"geocoordinates": {
"modelLocationOf": {
"x": 3.5507595647023336,
"y": 3.4784207745132183,
"z": -0.0000031264498829841614
}
}
}
}
}
Sample Mutations
We offer mutations to allow customers to provide their own GeoCoordinates to a model. To ensure the integrity of the provided data, patched values do not remove the original data. We have provided a reset mutation to allow customer’s to restore provided GeoCoordinate data.
Patch a Model's GeoCoordinates
Sample Query:
mutation patchGeoCoordinates(
$modelId: ID!
$altitude: Float
$latitude: Float
$longitude: Float
$translation: IPoint3D
$rotation: IQuaternion
) {
patchModelGeoCoordinates(
id: $modelId,
altitude: $altitude,
latitude: $latitude,
longitude: $longitude,
translation: $translation,
rotation: $rotation
) {
... GeoCoordinateFragment
}
}
fragment GeoCoordinateFragment on GeoCoordinate {
source
altitude
latitude
longitude
translation { x y z }
rotation { x y z w }
}
Variable Arguments:
{
"modelId": "",
"altitude": 0,
"latitude": 0,
"longitude": 0,
"translation": { "x": 0, "y": 0, "z": 0 },
"rotation": { "x": 0, "y": 0, "z": 0, "w": 0 }
}
Reset a Model's GeoCoordinates
Sample Mutation:
mutation resetGeoCoordinates(
$modelId: ID!
) {
resetModelGeoCoordinates(id: $modelId) {
... GeoCoordinateFragment
}
}
fragment GeoCoordinateFragment on GeoCoordinate {
source
altitude
latitude
longitude
translation { x y z }
rotation { x y z w }
}
Variable Arguments:
{
"modelId": ""
}