EOX-A / EOxElements

A Web Component collection of geospatial UI elements, crafted by EOX.
https://eox-a.github.io/EOxElements/
MIT License
12 stars 2 forks source link

Extend source format to allow providing projection information for Vector data #999

Closed santilland closed 4 months ago

santilland commented 5 months ago

Currently we can only pass the format type as string, eg.g. "format": "GeoJSON". Some GeoJSON data soruces do not use expected 4326 projection, we need a way to pass a projection. After some discussion with @silvester-pari we think allowing to pass also an object might be the best approach, e.g.:

"format": {"type" "GeoJSON", "options": {...GeoJSON options...}}

It would be good to understand if we can do this for other potential formats (GML, GPX, IGC, KML, MVT, WFS, WKB, WKT, XML, GPX, IGC, KML, WFS, WKT, GML2, GML3, GML32, OSMXML)?

VectorTiles "layer" have their own projection attribute, so there we can already pass a projection?

The example we would have is:

"format": {
    "type" "GeoJSON", 
    "options": {
        "dataProjection": "'EPSG:3035'"
    }
}
RobertOrthofer commented 5 months ago

GeoJSON that don't come in 4326 are not really following the standard, but sometimes I guess we have to deal with that... It was probably foreseeable that we need that feature at some point. I think this is a good idea, especially since we already are flexible via the eoxMapAdvancedOlFormats. Also, the options of our base formats GeoJSON and MVT are quite simple.

I have no real preference between setting the projection on the format vs on the source

santilland commented 5 months ago

It might be more understandable to have the projection on the source level, because this is how the other layer types do it, i imagine there were some good reasons in OL to do it on format level, so i guess it is also fine (or maybe even more robust?) to keep the same approach for eox-map definitions

santilland commented 5 months ago

Were you (or will you be) able to work on this @RobertOrthofer ?

RobertOrthofer commented 5 months ago

i will try to make a PR today, I'm also trying to use the types of the new ol while being at it

santilland commented 4 months ago

Turn out that registering the projections is a bit of a complication in some places, as we instantiate eox-maps quite dynamically based on content, so we are looking into solving that, but in general for now the solution looks good