Floor plans

Floor plans

The location updates provided by the NAO Suite are provided in the WGS84 referential (longitude, latitude). See section “How to convert coordinates” to see how to switch from WGS84 to pixels.

Download map package

When you upload floor plan as images to NAO Cloud and then align them with the building footprint, the images get geo-referenced. This georeference information can be retrieved from NAO Cloud together with the images.

In order to download the map package :

  • Go to your site on NAO Cloud.
  • From the left-side menu, click on Developer > Resources.
  • Scroll down and find the Maps section then click on Download map package.

In the package you will find for each floor :

  • The original image.
  • KML file that can be opened with Google Earth to display the image on top of Google Maps.
  • XML file that contains the geo-referencing information that can be used to convert cordinates between the WGS84 system (longitude / latitude) and image pixel system.

 

Note You can obtain the maps metadata, using the REST API.

Understanding KML

KML is an open standard officially named the OpenGIS® KML Encoding Standard (OGC KML). It is maintained by the Open Geospatial Consortium, Inc. (OGC). The complete specification for OGC KML can be found at http://www.opengeospatial.org/standards/kml/.

The complete XML schema for KML is located at http://schemas.opengis.net/kml/.

Here is an example of map package corresponding to Pole Star’s french office : maps_PoleStar.

You’ll find the following elements in the zip :

1_floor1_buildingMy Building.kml
1_floor1_buildingMy Building.png
1_floor1_buildingMy Building.xml
2_floor2_buildingMy Building.kml
2_floor2_buildingMy Building.png
2_floor2_buildingMy Building.xml

Looking at the content of 1_floor1_buildingMy Building.kml, we have :

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.1">
<GroundOverlay>
  <name>My Building - 1</name>
  <Icon>
    <href>1_floor1_buildingMy Building.png</href>
    <viewBoundScale>1.00</viewBoundScale>
  </Icon>
  <LatLonBox>
    <north>43.564402848056</north>
    <south>43.564174029578</south>
    <east>1.387571242989</east>
    <west>1.386984158534</west>
    <rotation>-17</rotation>
  </LatLonBox>
</GroundOverlay>
</kml>

Essentially, what this KML says is “to georeference picture 1_floor1_buildingMy Building.png on the Earth, here is its LatLonBox”.

What is a LatLonBox? More info at https://developers.google.com/kml/documentation/kmlreference#latlonbox

<LatLonBox> Specifies where the top, bottom, right, and left sides of a bounding box – the contours of your floor image – for the ground overlay are aligned.

  • <north> Specifies the latitude of the north edge of the bounding box, in decimal degrees from 0 to ±90.
  • <south> Specifies the latitude of the south edge of the bounding box, in decimal degrees from 0 to ±90.
  • <east> Specifies the longitude of the east edge of the bounding box, in decimal degrees from 0 to ±180. (For overlays that overlap the meridian of 180° longitude, values can extend beyond that range.)
  • <west> Specifies the longitude of the west edge of the bounding box, in decimal degrees from 0 to ±180. (For overlays that overlap the meridian of 180° longitude, values can extend beyond that range.)
  • <rotation> Specifies a rotation of the overlay about its center, in degrees. Values can be ±180. The default is 0 (north). Rotations are specified in a counterclockwise direction.

How to convert coordinates

Standard process

a. Description

The Location object from the NAO Suite is in WGS84 system (longitude, latitude), thus in order to display this location on the image, we need to convert it to the pixel coordinates system. The conversion is easier with the georeference information in the XML files inside the map package.

The georeference information returned by NAO Cloud has the following format:

<?xml version='1.0' encoding='UTF-8'?>
<Map_info 
    name='1322' 
    clockwiseRotationDegrees='15' 
    altitude='5' 
    pixelsPerMeter='11.85237609489639' 
    file='1322_floor1_buildingMain.jpg'>
   <Matrix 
        OffsetLat='37.41209344905285' 
        OffsetLon='-122.00936907555737' 
        YLat='-7.3262813931385e-07' 
        XLat='-1.9675557357910394e-07' 
        YLon='-2.4610123022592664e-07' 
        XLon='9.205604832527496e-07'/>
   <Inv_matrix 
        LonX='1013526.7794654198' 
        LatX='-340459.46901106957' 
        LonY='-272194.0806399637' 
        LatY='-1273514.6956928407' 
        OffsetX='136397064.3740145' 
        OffsetY='14434622.759019297'/>
</Map_info>

The pixel referential is assumed as follows:

Note You can obtain the maps metadata, using the REST API.

b. WGS84 to pixels

To convert (longitude, latitude) to (X,Y): use <Inv_matrix> item

X = longitude*LonX + latitude*LatX + OffsetX
Y = longitude*LonY + latitude*LatY + OffsetY

c. Pixels to WGS84

To convert (X,Y) to (longitude, latitude): use <Matrix> item

longitude = XLon*X + YLon*Y + OffsetLon;
latitude = XLat*X + YLat*Y + OffsetLat;

How to use maps with different ratio on NAO Cloud and in your app

The following process assumes NAO Cloud is using technical maps, and the app is using decorated maps.

On NAO Cloud

  1. Clone production site on NAO Cloud
  2. Import the decorated maps on the clone
  3. Change the maps floor levels/altitudes
    1. Decorated maps should be at the same altitudes as the production maps
    2. Technical maps: Any other floor level/altitude that is not used in production (keep it easy to come back to, e.g. do floor level + X*10 and altitude+(X*5), adjusting X to the original floor count)
  4. Align the decorated maps with the technical maps
  5. Delete technical maps from clone site (optional)

In your app

  1. Retrieve the georeferencing information of the decorated maps site.
  2. Follow the guide above to convert (lat, lon) coordinates to local (x, y) aligned with the decorated maps.

How to use maps with different orientation on NAO Cloud and in your app

Using the (X, Y) from section b above.
For anti-clockwise rotation in your app:
rotated_X = Y
rotated_Y = rotated_image_height - X
For anti-clockwise rotation in your app:
rotated_X = rotated_image_width - X
rotated_Y = X

    • Related Articles

    • Sample code

      The following code shows an example of how to infer the floor information from the altitude of a location update, and convert the (lat, lon) coordinates to pixel (x, y) to ease display on an image map. 1 import matplotlib.pyplot as plt 2 import ...
    • Getting maps metadata

      Each NAO Cloud site has 1 or more buildings. Each building has 1 or more floors. The metadata of each site, building and floor can be retrieved via the REST API. Buildings To get information of all the buildings of the site, use the following API: ...
    • Release 4.8

      Release V4.8.0 Date: 30 january 2019. Build: V4.8.0-R50afb77. New Features Location on Wi-Fi: NAO® SDK Android and iOS supports Wi-Fi Cell-ID as a sensor for the location service. Moving sites: If a site is moving on the Earth map, such a ship, you ...
    • Release 22.06 (NAO SDK 4.11.7.8 / Hot Fix iOS 4.11.7.9)

      Versions Component Version Hotfix NAO® Cloud 22.06 NAO® SDK iOS 4.11.7.8 4.11.7.9 NAO® SDK Android 4.11.7.8 NAO® Logger iOS 4.11.7.8 NAO® Logger Android 4.11.7.8 New Features NAO® Cloud Nao track web app is now available Nao track web app crash ...
    • Release 4.1

      Release V4.1.3 Date: 5 October 2016 Build: V4.1.3-R16108 Fixed Issues Fix issue: Alert not fired for type iBeacon detection when condition is Out of range of beacon(s) Fix issue for iOS: SDK crashed when using a CLCircularRegion Fix timestamp issue ...