pygeoapi icon indicating copy to clipboard operation
pygeoapi copied to clipboard

Investigate better CRS handling in HTML templates

Open webb-ben opened this issue 6 months ago • 1 comments

Is your feature request related to a problem? Please describe. pygeoapi currently uses Leaflet in all of it's default HTML templates to produce web maps. pygeoapi also supports multiple CRSs as implementations of OGC API. The lack of support for different HTML map CRSs that pygeoapi implements, introduces some misleading HTML behaviors and views. This is an issue because the maps appear to look wrong even if everything is working as intended.

As noted in #2010 (which appears to also affect QGIS), changing the CRS of a geoJSON response can have confusing behaviors on the map. Requesting for the demo pygeoapi windmills collection, the HTML of ESPG:4326 appears to be in the ocean and ESPG:3857 to not appear on the map at all. Although some of this has to do with OGC API expanding the GeoJSON spec as far as I understand

As noted in #2042 tile layers projected in OGC:CRS84 do not appear at all in the HTML map. #2022 stretches the TileLayer to align with the CRS:84 OGC API Tiles, but it still is projecting ORC:CRS84 geometry on top of a ESPG:3857 base-map. It is possible to make this look correct by using a WMSTileLayer instead, but this would override the configuration file's map options.

Image

and then here is the visual distortion between OGC:CRS84 and EPSG:3857

Image

Describe the solution you'd like There are a couple of ways to go about this.

  • A first pass could be an implementation of an additional HTML Template theme that replaces the leaflet functionality with openlayers.
  • We could expand the configuration section to better enumerate and configure the mapping engine used in the default templates.
  • We could replace leaflet in the default templates

Describe alternatives you've considered If there is a public OSM TileLayer that supports additional projections I would be interested in seeing how to incorporate this (cc: @IvanSanchez not sure if you have any wisdom here). I can't tell if the issue is just that there is no real public endpoint for OSM tiles in a different projection or because of something else.

Additional context Add any other context or screenshots about the feature request here.

webb-ben avatar Jun 27 '25 14:06 webb-ben

(cc: @IvanSanchez not sure if you have any wisdom here).

I'm partial to using Gleo for this kind of task, since I've spent a lot of time to make sure it can warp rasters and display geometries in pretty much any known EPSG CRS. Do play with https://ivansanchez.gitlab.io/gleo/repl.html#Guessed%20France%20Lambert%20%2B%20ArrugatedRaster

IvanSanchez avatar Jun 27 '25 14:06 IvanSanchez

+1 for a community theme. In terms of updating in pygeoapi proper, we would need to consider CoverageJSON support as well (not sure if OL supports). Having said this, we already have an extensibility mechanism that would facilitate an external theme, which can be implemented independently of the core release cycle.

tomkralidis avatar Jul 08 '25 00:07 tomkralidis

Potentially relevant, OSM now has vector tiles https://blog.openstreetmap.org/2025/07/22/vector-tiles-are-deployed-on-openstreetmap-org/

webb-ben avatar Jul 30 '25 11:07 webb-ben

This Issue has been inactive for 90 days. As per RFC4, in order to manage maintenance burden, it will be automatically closed in 7 days.

github-actions[bot] avatar Nov 02 '25 03:11 github-actions[bot]

As per RFC4, this Issue has been closed due to there being no activity for more than 90 days.

github-actions[bot] avatar Nov 16 '25 03:11 github-actions[bot]