Spatially aligning GIS data

For a little bit of context, there are two ways to access GIS data in the iTwin.js ecosystem. One way is by synchronizing it in an iModel through the iTwin synchronizer and the other way is by referencing it to the iModel through the Map Layers widget.

If you do not know where to start, this user guide will help you to choose the best solution for your needs - GIS Data in iTwinJS ecosystem - Best Practices Guide.pdf

Synchronization

When GIS data is synchronized to the iModel with the iTwin Synchronizer, the coordinate system of the source file is reprojected to the coordinate of the iModel.

What should you do to geolocate GIS data properly?

Before synchronizing GIS data, ensure that his data can be reprojected to the coordinate system of the iModel. So, it is essential to know the iModel's coordinate system and the GIS data's coordinate system.

The coordinate system of the file that is used to define the coordinate system of the iModel must be a projected coordinate system. When creating a connection to a non-geolocated iModel, you can select a geolocated input file to set the iModel geographical coordinate system. If no file is selected, the first geolocated input file found will be used to set the iModel geographical coordinate system. In this case, the coordinate system units must be a projected coordinate system (i.e., foot or meters). You cannot select a file that has a Geodetic coordinate system (i.e., using degree units). If you do so, the synchronization will fail with an error message.

Note that the subsequent files added to the connection can be in meters, feet, or degrees. Thus, a KML file cannot be defined as the spatial root of an iModel because a KML file is obligatory in lat-long. As stated in the previous paragraph, the geodetic coordinate system is not supported as a spatial root.

Ways you can check the GCS and spatial alignment

Most of the GIS data can be opened in QGis (A Free and Open-Source Geographic Information System), and then attaching the Bing layer to the view will allow us to see if it fits properly on Bing. 

  • If it does on Bing, it will fit properly in the iTwin viewer with the Bing Basemap layer.
  • If it doesn't fit, it may be due to the following reasons:

    • The assigned coordinate system is not the good one
    • The GIS data has no GCS assigned at all

If it doesn't fit with the iModel, then the alignment problem is most likely with the iModel and not the GIS data itself.

Some desktop products like MicroStation or OpenCities Map could also be used to attach GIS formats to the BIM file to see if it fits. MicroStation can attach .shp files in reference. OpenCities Map can attach or import multiple GIS formats like KML files, Oracle, PostGIS and SQL databases, ArcGIS FeatureServer, and ESRI file geodatabase.

If it doesn't fit when displayed in Power Platform products, it will be misaligned in iTwin.

Referencing through the iModel with the Map Layers widget

The Map Layers widget allows managing the display of the Base Layer and ArcGIS, WMS, and WMTS layers. The layers are displayed as raster layers in the iTwin viewer-based applications.

What should you do to geolocate GIS data properly?

The Map Layers widget requests the data to be in EPSG:3857 or EPSG:4326. An error message will be displayed if you try to attach a GIS layer with a different coordinate system. 

There is an exception to this. The map layers widget supports servers with different GCS if and only if the server can reproject to EPSG:3857.

  • Suppose the server has pre-generated tiles (single fused map cache set to True) in a coordinate system other than 3857 or 4326. In that case, attaching it through the map layers widget will not be possible as the tiles are cached, and no reprojection is possible in this specific case.
  • On the other hand, for example, if a layer is in EPSG:28992 with the parameter "single fused map cache" set to false, it will be attached correctly in the map layers widget. The single fused map cache parameter can be seen in the layer's capabilities.

Here are the layer's response to the GetCapabilities query.

Ways you can check the GCS and spatial alignment

The three supported formats can be opened in QGis (A Free and Open-Source Geographic Information System), and then attaching the Bing layer to the view will allow us to see if it fits properly on Bing. 

  • If it does on Bing, it will fit properly in the iTwin viewer with the Bing Basemap layer.

Issues examples

Recommended
Related