Coordinate systems

An introduction to the coordinate system used for placement of spaces and devices.

Currently, we support two different coordinate systems for Spaces and one coordinate system for Devices.

Real coordinates

Real coordinates is only applicable Spaces of type Building, and represent the lat / lon location of the building. This is specified in the GeoJSON coordinates as [latitude, longtitude, altitude], where the altitude is optional and ignored.

Example Building Space
{
  ....
  "type": "SPACE_BUILDING",
  "coordinates": "COORDS_REAL",
  "image": "https://app.neowit.io/api/image/v1/image/<someimage>",
  "features": {
    "type": "Feature",
    "geometry": {
      "type": "Point",
      "coordinates": [
        -74.0088256,
        40.7060361,
        0
      ]
    },
    "properties": {
      "address": "Wall St, New York, NY, USA"
    }
  }
}

Virtual coordinates

The virtual coordinate system is a bit difficult to work with, as it is tightly coupled with our web app and its deck.gl usage. In the future, we will introduce a better coordinate system that is easier to work with and maps better to real word coordinates.

Spaces

All Spaces except Buildings are defined using a GeoJSON Feature using Polygon geometry.

Devices

Devices may be given a position using a GeoJSON Feature using Point geometry. Note that this only makes sense if the Device has an associated Space.

Basic workings of the coordinate system

  • 2-dimensional Cartesian coordinate system (x, y) - floating numbers.

  • Bounding box is defined as with a range of (0, 0) - (1000, 1000). Which yields the following coordinates:

  • The image uploaded as part of the Floor is preserved in its full size, but we do an object fit into the bounding box, preserving its aspect ratio, when mapping it into the coordinate system. Origo of the object fit is Cartesian (x, y) = (0, 0).

  • Coordinates outside of the [0, 1000] range are permitted for historic reasons.

Converting between image pixel and Cartesian

Example conversion code for TypeScript is show below. This is a small utility class to convert between Cartesian and pixel coordinates defined by the uploaded image.

Example 1 - Image where width > height

Example 2 - Image where width < height

Example 3 - Image where width == height

Last updated