Geospatial & Maps
This SDK is designed to handle data with real-world geographic context. It provides tools for georeferencing project data and rendering global map tiles.
Georeferencing
Data usually exists in one of two states: a geographic location (Latitude/Longitude), or a projected coordinate in a local 3D workspace. The fsl_geospatial libraries bridge these worlds:
- Coordinates: Support for standard WGS84 Latitude/Longitude, UTM (Universal Transverse Mercator), and local Cartesian grids.
- Ellipsoids: Earth’s shape is modeled using standard ellipsoids like WGS84 or GRS80 to maintain precision in distance and area calculations.
- Projections: The SDK handles standard projections and unprojected geocentric systems like ECEF for true 3D global visualization.
Workflow: From Lat/Long to Viewport
Bringing survey data into a project involves establishing a Spatial Triad. This structure defines how a geographic projection, an origin point, and a scale factor combine to create a local coordinate system.
Once a Triad is established, you can use the Geo-Context resource. This global source of truth ensures all plugins use a consistent project location. By updating the Geo-Context, you can change projections (for example, switching from a global ECEF view to a local UTM zone) while coordinate conversions are handled by the engine.
Web Map Tile Service (WMTS)
The SDK includes a Web Map Tile Service (WMTS) renderer. This allows you to contextualize 3D data, such as drone surveys or engineering designs, within global satellite imagery and terrain.
Quadtree Map Rendering
The map renderer uses a quadtree-based approach to stream tiles from services like ArcGIS, Mapbox, or OpenStreetMap. By loading tiles dynamically based on the current view, the SDK provides a global map experience while optimizing memory usage.
The renderer can also consume elevation data to create 3D terrain surfaces. You can configure custom tile server endpoints for both imagery and terrain.
Switching Projections
The SDK can handle multiple geographic projections on the fly. This is useful for professionals who need to view a project in a global context (ECEF) and then switch to a local engineering grid (UTM) for detailed work.
The transition is handled by automatically reprojecting map tiles, UI elements, and coordinate labels. If you change the global GeoProjection, measurements and labels update to reflect the new coordinate system.
Developer Integration
Integrating geospatial features into a plugin is handled through the GeoContext resource.
fn my_geographic_system(geo_context: Res<GeoContext>) {
// Access the current spatial triad (projection, origin, and scale)
let triad = &geo_context.spatial_triad;
// Respond to changes in the project's real-world location
}Roadmap: Model Warping
While the engine can switch projections for map data, reprojecting large 3D models and point clouds at the vertex level is more complex. Potential approaches include:
- Affine Warp: Using efficient linear transformations to approximate reprojection for smaller models.
- Per-Vertex Reprojection: Developing pipelines for accurate reprojection of all points or vertices for maximum precision.