Howto:Adding new projections to Canvas Map

From FlightGear wiki
Jump to navigation Jump to search
This article is a stub. You can help the wiki by expanding it.

Status

Background

any Canvas-based MFD using the "map" element (aka all ND/MapStructure stuff) suffers from the same issue when dealing with the polar coordinates, because the projection code was adopted from the hard-coded MapWidget implemented by James originally.

While the MapWidget and the original NavDisplay received updates/patches by Gijs and James, the Canvas projection code has never been updated accordingly.[1]

The Map dialog is now scheduled to be phased out.

TheTom stated already back in 2013, that projecting coordinates is already possible but that we'd need need some more projections. [2]

A few years later, in 09/2017, Stuart pushed some changes to fgdata with OpenStreetMap, OpenAIP and VFRMap layers for the Canvas Map Layer system, which can be seen on the canvas map dialog. They use a generic Slippy Map OverlayLayer Map Layer. Additional web-based mapping can be trivially added by creating a new lcontroller. See Nasal/Canvas/map/OpenAIP.lcontroller for an example.

Stuart also added a Web Mercator Projection to the Canvas Map support.[3]

And he acknowledged, that ticket #55 has been not addressed yet. And that there may be a problem here with the map tiles as well, which are using a different projection again... [4]

Ideas

There are several quick fixes that could be used at this point, either back-porting the work previously committed by James and GIjs, or exposing the projection handling to Nasal space via cppbind, so that a Nasal function can be used instead. Originally, Tom didn't like the latter though, because he wanted to avoid unnecessary Nasal overhead at runtime. Another idea we toyed with in response to TorstenD commenting on the issue, was using the property rule system for projections - because those are automatically XML-configurable, and everything runs at C++ speed anyway.

Technically, that would entail adding new projections in the form of property rules and then adding a Canvas projection to use a configurable property rule for each projection.

But if that's done, we'd have native speed/performance, and XML-level configuration options in XML space, i.e. if/when the need arises for a new projection, it can be implemented in the form of property rules.[5]


Nasal based Projections

Property Rule based Projections

GDAL/OGR (PROJ)


References

References