Augmented City API (2.3.0)

Download OpenAPI specification:Download

Introduction

This is an API for the Augmented City (AC) platform. For more information, please visit our website https://www.augmented.city

Coordinate Systems and Axes Conventions

Local Coordinate System

Local coordinate system is a right-handed cartesian coordinate system of a single reconstruction. It’s based on camera coordinate system. The local camera coordinate system of an image is defined in a way that the X axis points to the right, the Y axis to the bottom, and the Z axis to the front as seen from the image.

Local coordinate system

The local reconstruction coordinate system has no metric scale. Each reconstruction has a unique coordinate system with its own scale.

Geographic Coordinate System

AC supports two geographic coordinate systems ECEF and ENU.

Geographic coordinate system

ECEF

ECEF, also known as ECR, is a geographic and Cartesian coordinate system and is sometimes known as a "conventional terrestrial" system. It represents positions as X, Y, and Z coordinates. The point is defined as the center of mass of Earth, hence the term geocentric coordinates. Read more on Wikipedia

ECEF coordinate system

ENU

Local tangent plane coordinates (LTP) are a geographic coordinate system based on the tangent plane defined by the local vertical direction and the Earth's axis of rotation. It consists of three coordinates: one represents the position along the northern axis, one along the local eastern axis, and one represents the vertical position. The local ENU coordinates are formed from a plane tangent to the Earth's surface fixed to a specific location and hence it is sometimes known as a "Local Tangent" or "local geodetic" plane. By convention the east axis is labeled x, the north y and the up z. Read more on Wikipedia

ENU coordinate system

GeoPose

Description

GeoPose is a geographically-anchored pose with 6 degrees of freedom. Position is presented as WGS-84 Geodetic point, rotation is presented as quaternion in ENU coordinate system. Example:

{
  "position": {
    "lat": 59.93930066333559,
    "lon": 30.216465340943543,
    "h": 6.6434114027277181
  }
  "quaternion": {
    "w": -0.3363841028150708,
    "x": 0.6584681350287606,
    "y": -0.4366714830997145,
    "z": -0.5124289866630708
  }
}

See OSCP GeoPose Protocol

How to Convert to Cartesian Coordinate System

Position

  1. Select a reference geodetic point (lat_ref, lon_ref, h_ref), which will be the origin of your local coordinate system. For example, this could be the first position of a camera.

  2. Convert geodetic position of GeoPose to position in ECEF coordinate system:

import math

a = 6378137
b = 6356752.3142
f = (a - b) / a
e_sq = f * (2 - f)

# Converts WGS-84 Geodetic point (lat, lon, h) to the
# Earth-Centered Earth-Fixed (ECEF) coordinates (x, y, z).
def geodetic_to_ecef(lat, lon, h):
  lamb = math.radians(lat)
  phi = math.radians(lon)
  s = math.sin(lamb)
  N = a / math.sqrt(1 - e_sq * s * s)

  sin_lambda = math.sin(lamb)
  cos_lambda = math.cos(lamb)
  sin_phi = math.sin(phi)
  cos_phi = math.cos(phi)

  x = (h + N) * cos_lambda * cos_phi
  y = (h + N) * cos_lambda * sin_phi
  z = (h + (1 - e_sq) * N) * sin_lambda

  return x, y, z
  1. Convert ECEF position to ENU position:
# Converts the Earth-Centered Earth-Fixed (ECEF) coordinates (x, y, z) to
# East-North-Up coordinates in a Local Tangent Plane that is centered at the
# (WGS-84) Geodetic point (lat_ref, lon_ref, h_ref).
def ecef_to_enu(x, y, z, lat_ref, lon_ref, h_ref):
  lamb = math.radians(lat_ref)
  phi = math.radians(lon_ref)
  s = math.sin(lamb)
  N = a / math.sqrt(1 - e_sq * s * s)

  sin_lambda = math.sin(lamb)
  cos_lambda = math.cos(lamb)
  sin_phi = math.sin(phi)
  cos_phi = math.cos(phi)

  x0 = (h_ref + N) * cos_lambda * cos_phi
  y0 = (h_ref + N) * cos_lambda * sin_phi
  z0 = (h_ref + (1 - e_sq) * N) * sin_lambda

  xd = x - x0
  yd = y - y0
  zd = z - z0

  xEast = -sin_phi * xd + cos_phi * yd
  yNorth = -cos_phi * sin_lambda * xd - sin_lambda * sin_phi * yd + cos_lambda * zd
  zUp = cos_lambda * cos_phi * xd + cos_lambda * sin_phi * yd + sin_lambda * zd

  return xEast, yNorth, zUp

Orientation

Use quaternion as is.

Example

def geodetic_to_enu(lat, lon, h, lat_ref, lon_ref, h_ref):
  x, y, z = geodetic_to_ecef(lat, lon, h)

  return ecef_to_enu(x, y, z, lat_ref, lon_ref, h_ref)

geopose = {"position": {
              "lat": 59.93930063661516,
              "lon": 30.21646537256484,
              "h": 6.6359911204808377
           }
           "quaternion": {
              "w": 0.24078175147153705,
              "x": 0.23898354967230406,
              "y": -0.6720152706953141,
              "z": -0.6582601971079732
            }}

lat_ref = 59.93930066333559
lon_ref = 30.216465340943543
h_ref = 0.434114027277181

lat = geopose['position']['lat']
lon = geopose['position']['lon']
h = geopose['position']['h']

position_ref = geodetic_to_enu(lat_ref, lon_ref, h_ref, lat_ref, lon_ref, h_ref)
print(f"Reference ENU position: {position_ref}")

position = geodetic_to_enu(lat, lon, h, lat_ref, lon_ref, h_ref)
quaternion = [geopose['quaternion']['w'], geopose['quaternion']['x'],
              geopose['quaternion']['y'], geopose['quaternion']['z']]

print(f'Object ENU position: {position}\nObject ENU orientation: {quaternion}')

Output:

Reference ENU position: (0.0, 0.0, 0.0)
Object ENU position: (0.0017677017435744347, -0.0029769590309327576, 6.201877094031028)
Object ENU orientation: [0.24078175147153705, 0.23898354967230406, -0.6720152706953141, -0.6582601971079732]

For detailed information about coordinate systems, see Geographic coordinate system.

How to Convert to WebXR Coordinate System

  1. Convert from Geopose to ENU coordinate system as shown above
  2. Convert from ENU, which is a right-handed, X forward, Y to the left, Z up coordinate system, to WebXR, which is also right-handed but X to the right, Y up, Z backwards coordinate system.

Check WebXR OSCP client

Camera

ENU to WebXR coordinate system

Object

ENU to WebXR coordinate system

How to Convert to Unity Coordinate System

  1. Convert from Geopose to ENU coordinate system as shown above
  2. Convert from ENU, which is a right-handed, X forward, Y to the left, Z up coordinate system, to Unity, which is a left-handed, X to the right, Y up, Z forward coordinate system.

Check OSCP Unity Client example

Camera

ENU to Unity coordinate system

Object

ENU to Unity coordinate system

OSCP API

Augmented City implementation of OSCP API

See more on https://www.openarcloud.org/oscp and https://github.com/OpenArCloud

Get camera geopose

Get camera geopose. See GeoPose

Request Body schema: application/json
id
required
string (Id)
timestamp
required
integer (Timestamp)

The number of milliseconds since the Unix Epoch.

type
required
string

Ex. geopose. Unused property

required
Array of objects (Sensor)
required
Array of objects (SensorReading)
Array of objects (GeoPoseResp)

Previous geoposes. Unused property

object (LocalizationHint)

List of reconstruction identifiers. The service will perform localization sequentially in each reconstruction according to the order specified in the list until the first successful result is obtained. If hint_only is true, the service will localize only in the specified reconstructions. If hint_only is false, the service will continue localization attempts in the nearest reconstructions

Responses

Request samples

Content type
application/json
{
  • "id": "string",
  • "timestamp": 0,
  • "type": "string",
  • "sensors": [
    ],
  • "sensorReadings": [
    ],
  • "priorPoses": [
    ],
  • "hint": {
    }
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "timestamp": 0,
  • "accuracy": {
    },
  • "type": "string",
  • "geopose": {
    },
  • "ecefPose": {
    },
  • "localPose": {
    },
  • "reconstruction_id": 390
}

Get camera geopose and objects scene

Get camera geopose and objects scene. See GeoPose

Request Body schema: application/json
id
required
string (Id)
timestamp
required
integer (Timestamp)

The number of milliseconds since the Unix Epoch.

type
required
string

Ex. geopose. Unused property

required
Array of objects (Sensor)
required
Array of objects (SensorReading)
Array of objects (GeoPoseResp)

Previous geoposes. Unused property

object (LocalizationHint)

List of reconstruction identifiers. The service will perform localization sequentially in each reconstruction according to the order specified in the list until the first successful result is obtained. If hint_only is true, the service will localize only in the specified reconstructions. If hint_only is false, the service will continue localization attempts in the nearest reconstructions

Responses

Request samples

Content type
application/json
{
  • "id": "string",
  • "timestamp": 0,
  • "type": "string",
  • "sensors": [
    ],
  • "sensorReadings": [
    ],
  • "priorPoses": [
    ],
  • "hint": {
    }
}

Response samples

Content type
application/json
{
  • "geopose": {
    },
  • "scrs": [
    ]
}

Get SCRs covering h3Index

Get SCRs covering h3Index

path Parameters
topic
required
string
query Parameters
h3Index
string

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get SCRs by GPS and radius

Get SCRs by GPS and radius

Authorizations:
bearerAuth
query Parameters
lat
required
number <double>

Latitude

lon
required
number <double>

Longitude

r
required
number <float>

Search radius, m

project_id
integer (ProjectId)
Example: project_id=3

Project id. Return objects belonging to the specified project id. Only one project_id could be specified. Return objects belonging to the public project if project id isn't specified.

reconstruction_id
integer (ReconstructionId)
Example: reconstruction_id=390

Reconstruction id. Return objects belonging to the specified reconstruction. Only one reconstruction_id could be specified. Return all objects around if reconstruction id isn't specified.

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Reconstruction

Get augmented cities list

Get the list of augmented cities. Localization is possible only inside scanned and reconstructed areas. Information about reconstructed areas will be provided in the future.

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get augmented city by gps

Get augmented city by gps point

query Parameters
p_latitude
required
number <double>

GPS latitude

p_longitude
required
number <double>

GPS longitude

Responses

Response samples

Content type
application/json
{
  • "city_id": 0,
  • "city": "Saint Petersburg",
  • "country": "Russia",
  • "description": {
    }
}

Create reconstruction task

Create a new task to reconstruct a series of images. The task passes to the status of waiting for image upload after creation. After receiving a signal that the images have been uploaded, the task is added to the queue for processing.

Request Body schema: application/json
client
required
string

Application name

daytime
required
string (ScanDaytime)
Enum: "DAY" "EVENING" "NIGHT"
Time of day Description
DAY
EVENING
NIGHT
device
required
string

Phone or camera model

name
required
string

Location name

required
Array of objects (ScanPassages)
user
required
string

User login or id

Responses

Request samples

Content type
application/json
{
  • "client": "AC Scanner version_name: 1.0 version_type: release",
  • "daytime": "DAY",
  • "device": "Mi MIX 3",
  • "name": "Elm street",
  • "passages": [
    ],
  • "user": "user@mail.com"
}

Response samples

Content type
application/json
{
  • "task_id": "736fde4d-9029-4915-8189-01353d6982cb",
  • "images": [
    ],
  • "stage": "UPLOAD",
  • "status": {
    },
  • "reconstruction_id": 390
}

Upload images for reconstruction

Upload images for reconstruction. You can upload one image or a group of images at a time. To send a signal that the upload is complete, call the method without image data. After receiving such a signal that images are being uploaded, the service adds the task to the queue and changes its status to IN_QUEUE. When the status is changed, new images cannot be uploaded.

query Parameters
task_id
required
string <uuid> (ReconstructionTaskId)

Reconstruction task id. Only one task_id could be specified

Request Body schema: multipart/form-data

Image or images list. Call with no images data to finish uploading and start reconstruction

image
string <binary> (ImageWithExif)

A JPEG-encoded image, must include GPS data in EXIF tags

Responses

Response samples

Content type
application/json
{
  • "task_id": "736fde4d-9029-4915-8189-01353d6982cb",
  • "images": [
    ],
  • "stage": "UPLOAD",
  • "status": {
    },
  • "reconstruction_id": 390
}

Get reconstruction task status

Get series reconstruction task status by task id. Several task ids could be specified. Return status for known task ids. Return nothing for unknown task ids.

Property reconstruction_id is available only if reconstruction is done successfully.

Property status is available after the reconstruction task has moved to the DONE stage.

Property images is available only during the UPLOAD stage. Use the property to check which images have been uploaded.

query Parameters
task_id
required
Array of strings <uuid> (ReconstructionTaskIds)

Task id

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Objects

Operations with objects

Add AR object by local pose

Add a custom object by 3d pose

Request Body schema: application/json
reconstruction_id
required
integer (ReconstructionId)

Reconstruction id

required
object (Pose)
Array of objects (Frame3d) = 4 items
required
object (ARObjectDescription)

Responses

Request samples

Content type
application/json
{
  • "reconstruction_id": 390,
  • "pose": {
    },
  • "frame": [
    ],
  • "description": {
    }
}

Response samples

Content type
application/json
{
  • "objects_info": [
    ],
  • "status": {
    }
}

Add AR object by geopose

Add a custom object by geopose. See GeoPose

Request Body schema: application/json
reconstruction_id
required
integer (ReconstructionId)

Reconstruction id

required
object (GeoPose)
required
object (ARObjectDescription)

Responses

Request samples

Content type
application/json
{
  • "reconstruction_id": 390,
  • "geopose": {
    },
  • "description": {
    }
}

Response samples

Content type
application/json
{
  • "objects_info": [
    ],
  • "status": {
    }
}

Add AR object by geopose from angles

Add a custom object by geopose from angles. See GeoPose.

Geopose rotation is expressed as a heading, pitch, and roll.

Heading is the rotation about the negative z axis. Pitch is the rotation about the negative y axis. Roll is the rotation about the positive x axis. Applied in that order.

Request Body schema: application/json
reconstruction_id
required
integer (ReconstructionId)

Reconstruction id

required
object
required
object (ARObjectDescription)

Responses

Request samples

Content type
application/json
{
  • "reconstruction_id": 390,
  • "geopose": {
    },
  • "description": {
    }
}

Response samples

Content type
application/json
{
  • "objects_info": [
    ],
  • "status": {
    }
}

Add AR object by geopose from height above ground level

Add a custom object by geopose from height above ground level. See GeoPose.

Request Body schema: application/json
reconstruction_id
required
integer (ReconstructionId)

Reconstruction id

required
object
required
object (ARObjectDescription)

Responses

Request samples

Content type
application/json
{
  • "reconstruction_id": 390,
  • "geopose": {
    },
  • "description": {
    }
}

Response samples

Content type
application/json
{
  • "objects_info": [
    ],
  • "status": {
    }
}

Add AR object by geopose from height above ground level and angles

Add a custom object by geopose from height above ground level and angles. See GeoPose.

Geopose rotation is expressed as a heading, pitch, and roll.

Heading is the rotation about the negative z axis. Pitch is the rotation about the negative y axis. Roll is the rotation about the positive x axis. Applied in that order.

Request Body schema: application/json
reconstruction_id
required
integer (ReconstructionId)

Reconstruction id

required
object
required
object (ARObjectDescription)

Responses

Request samples

Content type
application/json
{
  • "reconstruction_id": 390,
  • "geopose": {
    },
  • "description": {
    }
}

Response samples

Content type
application/json
{
  • "objects_info": [
    ],
  • "status": {
    }
}

Add AR object by image

Add a custom object by marked image. The image must be localizable in the system. Before calling the method check the image with localization api.

Request Body schema: multipart/form-data
required
object (ObjectWithMarkedImage)
image
required
string <binary> (ImageWithExif)

A JPEG-encoded image, must include GPS data in EXIF tags

Responses

Response samples

Content type
application/json
{
  • "objects_info": [
    ],
  • "status": {
    }
}

Update AR object local pose

Update object local pose

path Parameters
placeholder_id
required
integer (PlaceholderId)
Example: 1551

Placeholder id

Request Body schema: application/json
reconstruction_id
required
integer (ReconstructionId)

Reconstruction id

required
object (Pose)
Array of objects (Frame3d) = 4 items

Responses

Request samples

Content type
application/json
{
  • "reconstruction_id": 390,
  • "pose": {
    },
  • "frame": [
    ]
}

Response samples

Content type
application/json
{
  • "status": {
    }
}

Update AR object geopose

Update object geopose. See GeoPose

path Parameters
placeholder_id
required
integer (PlaceholderId)
Example: 1551

Placeholder id

Request Body schema: application/json
reconstruction_id
required
integer (ReconstructionId)

Reconstruction id

required
object (GeoPose)

Responses

Request samples

Content type
application/json
{
  • "reconstruction_id": 390,
  • "geopose": {
    }
}

Response samples

Content type
application/json
{
  • "status": {
    }
}

Update AR object geopose from angles

Update object geopose from angles. See GeoPose

path Parameters
placeholder_id
required
integer (PlaceholderId)
Example: 1551

Placeholder id

Request Body schema: application/json
reconstruction_id
required
integer (ReconstructionId)

Reconstruction id

required
object

Responses

Request samples

Content type
application/json
{
  • "reconstruction_id": 390,
  • "geopose": {
    }
}

Response samples

Content type
application/json
{
  • "status": {
    }
}

Update AR object geopose from height above ground level

Update object geopose from height above ground level. See GeoPose

path Parameters
placeholder_id
required
integer (PlaceholderId)
Example: 1551

Placeholder id

Request Body schema: application/json
reconstruction_id
required
integer (ReconstructionId)

Reconstruction id

required
object

Responses

Request samples

Content type
application/json
{
  • "reconstruction_id": 390,
  • "geopose": {
    }
}

Response samples

Content type
application/json
{
  • "status": {
    }
}

Update AR object geopose from height above ground level and angles

Update object geopose from height above ground level and angles. See GeoPose

path Parameters
placeholder_id
required
integer (PlaceholderId)
Example: 1551

Placeholder id

Request Body schema: application/json
reconstruction_id
required
integer (ReconstructionId)

Reconstruction id

required
object

Responses

Request samples

Content type
application/json
{
  • "reconstruction_id": 390,
  • "geopose": {
    }
}

Response samples

Content type
application/json
{
  • "status": {
    }
}

Update AR object content

Update AR object's content.

Request Body schema: application/json
required
Model3dData (object) or InfostickerData (object) or VideoData (object) or ImageData (object)

Responses

Request samples

Content type
application/json
{
  • "sticker": {
    }
}

Response samples

Content type
application/json
{
  • "status": {
    }
}

Update AR object content partially

Update AR object's content partially, all properties are not mandatory. Only sent properties would be changed, others remain untouched

Request Body schema: application/json
required
Model3dDataPartialUpdate (object) or InfostickerPartialDataUpdate (object) or VideoDataPartialUpdate (object) or ImageDataPartialUpdate (object)

Responses

Request samples

Content type
application/json
{
  • "sticker": {
    }
}

Response samples

Content type
application/json
{
  • "status": {
    }
}

Get objects list

Get objects by placeholders ids

Request Body schema: application/json
p_placeholder_ids
required
Array of integers (PlaceholderId)

Placeholders ids

p_language
string
Default: "en"

Object content language

Responses

Request samples

Content type
application/json
{
  • "p_placeholder_ids": [
    ],
  • "p_language": "ru"
}

Response samples

Content type
application/json
[
  • {
    }
]

Get placeholders list by gps

Get placeholders list by gps

query Parameters
p_latitude
required
number <double>

GPS latitude

p_longitude
required
number <double>

GPS longitude

p_radius
required
number <float>

Search radius

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Localization and scene acquisition

Localization and scene acquisition

Prepare localization session

Prepare for localization for given geolocation. Causes server to load nearby reconstructions for localization. Returns an error when localization in this location is not possible.

query Parameters
lat
required
number <double>

GPS latitude

lon
required
number <double>

GPS longitude

alt
number <double>

GPS altitude (optional)

dop
number <float>

GPS HDOP (optional)

Responses

Response samples

Content type
application/json
{
  • "status": {
    }
}

Localize camera

Localize uploaded image. Return camera pose and optional placeholders scene, surfaces scene and objects content. Camera, placeholders and surfaces coordinates are local coordinates in reconstruction coordinate system identified by reconstruction id.

Request Body schema:
required
object (ImageDescription)

Describes gps position and camera parameters

image
required
string <binary> (Image)

A JPEG-encoded image

object (LocalizationHint)

List of reconstruction identifiers. The service will perform localization sequentially in each reconstruction according to the order specified in the list until the first successful result is obtained. If hint_only is true, the service will localize only in the specified reconstructions. If hint_only is false, the service will continue localization attempts in the nearest reconstructions

Responses

Response samples

Content type
application/json
{
  • "camera": {
    },
  • "reconstruction_id": 390,
  • "placeholders": [
    ],
  • "surfaces": [
    ],
  • "objects": [
    ],
  • "status": {
    }
}

3d models

Operations with 3d models

Get 3d models list

Get a list of 3D models. Each 3D model has a preview image and can have several different file formats in order to use them with different platforms. 3d model has at least one file format.

query Parameters
platform
string (Platform)
Enum: "ios" "android" "uwp"

Filter for platform

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Add 3d model

Add 3d model to server

Request Body schema: multipart/form-data
name
required
string
<platform>
required
string <binary>

3d model file. Possible platform names:

Platform Description
ios Unity bundle for ios
android Unity bundle for android
uwp HoloLens (Direct3D) compatible 3d model
preview
required
string <binary>

A JPEG-encoded image

Responses

Response samples

Content type
application/json
{
  • "id": "string",
  • "status": {
    }
}

Update 3d model

Update 3d model at server

Request Body schema: multipart/form-data
name
string
<platform>
string <binary>

3d model file. Possible platform names:

Platform Description
ios Unity bundle for ios
android Unity bundle for android
uwp HoloLens (Direct3D) compatible 3d model
preview
string <binary>

A JPEG-encoded image

Responses

Response samples

Content type
application/json
{
  • "id": "string",
  • "status": {
    }
}

Delete 3d model

Delete 3d model from server

Responses

Response samples

Content type
application/json
{
  • "status": {
    }
}

Images

Operations with images files

Get images list

Get a list of images

Responses

Response samples

Content type
application/json
[]

Add image

Add image file to server

Request Body schema: multipart/form-data
name
required
string
image
required
string <binary>

A JPEG-encoded image

Responses

Response samples

Content type
application/json
{
  • "id": "string",
  • "status": {
    }
}

Update image

Update image at server

Request Body schema: multipart/form-data
name
string
image
string <binary>

A JPEG-encoded image

Responses

Response samples

Content type
application/json
{
  • "id": "string",
  • "status": {
    }
}

Delete image

Delete image from server

Responses

Response samples

Content type
application/json
{
  • "status": {
    }
}

Version

Get server version

Get server version

Get server version

Responses

Response samples

Content type
text/plain
2.7-1-g926829c AC-178-add_versioning 2020.06.19 13:12