Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no crs output in geojson when reprojecting to epsg with inverted axes #6966

Open
roelarents opened this issue Nov 7, 2023 · 0 comments
Open

Comments

@roelarents
Copy link

roelarents commented Nov 7, 2023

Expected behavior and actual behavior.

Expected a geojson output including a crs key. E.g.

{
"type": "FeatureCollection",
"name": "Something",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::3035" } },
"features": [
{ "type": "Feature", "id": "something", "properties": {}, "bbox": [ 1,2,3,4 ], "geometry": { "type": "Polygon", "coordinates": [ [ [ ] ] ] } }
],
"bbox": [ 1,2,3,4 ]
}

Actually received that without the crs key.

Steps to reproduce the problem.

Have a source in another srs than the request.

Ensure geojson RFC7946=OFF (default)

Make a WFS request with an output srs that has "inverted axes" (not x/y but y/x cq lat/lon cq north/east). E.g. EPSG:3035 or EPSG:4326. (Not using 4326 cq WGS84 in the example as to not confuse the crs being hidden for other reasons.)

QUERY_STRING=service=WFS&request=GetFeature&count=1&version=2.0.0&outputFormat=geojson&typeName=test&srsName=EPSG:3035

Analysis

When the output projection is made into a OGC WKT and it has "inverted axes", then +epsgaxis=ne is added to the proj string which is inputted to GDAL's importFromProj4. Resulting in a WKT named "unknown" and without authority name and code.

When that WKT is turned into an OGRSpatialReference and later on passed to GDAL to write the geojson, it has no URN (because no authority) and the crs key is skipped.

The coordinate axes are swapped though, but why would I want that?

Attached simple test case

wfs-test.zip

# commands.txt
mapserv -nh "QUERY_STRING=map=wfs-test.map&service=WFS&version=2.0.0&request=GetFeature&typeName=test&outputFormat=geojson&srsName=EPSG:3035" # output srs axis x,y (should be y,x according to epsg), no crs key
mapserv -nh "QUERY_STRING=map=wfs-test.map&service=WFS&version=2.0.0&request=GetFeature&typeName=test&outputFormat=geojson&srsName=EPSG:3857" # output srs axis x,y (correct according to epsg), yes crs key
mapserv -nh "QUERY_STRING=map=wfs-test.map&service=WFS&version=2.0.0&request=GetFeature&typeName=test&outputFormat=gml3&srsName=EPSG:3035" # output srs axis y,x (correct according to epsg), gml3, yes srsName

Operating system

ubuntu 20.04

MapServer version and installation method

mapserver 8.0.1 (from source)
proj 9.3 (from source)
gdal 3.6.2 (from source, also with proj 9.3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant