Subscribe to this thread
Home - General / All posts - GeoJSON URL ForceXY
joebocop
426 post(s)
online
#13-Oct-20 19:25

I have a data source of type geojsonserver as seen in the attached map file.

The projection claims it's epsg 4326 but requires a "Force XY" in M9 in order to display correctly. Since ForceXY can't be applied to a geojsonserver Data Source, I need to first copy the table and drawing into my project. Not ideal; is there a way to correctly handle this particular geojson response?

Attachments:
geojson_forcexy.map

Dimitri


6,233 post(s)
#14-Oct-20 08:31

Just to double check... are you saying the web server says it is publishing data in EPSG 4326 but then instead of the data being in YX order the way EPSG 4326 says, it is really in XY order?

If that's the problem, the correct way to handle that is to contact the webmaster for that site and tell them that they're publishing disinformation. If they say they use EPSG 4326 they should be publishing in YX order, not XY order. Refer them to the That YX Thing essay if they don't seem to understand they are doing something wrong.

If you make a local copy of the drawing/table, sure, Manifold can fix that. But if the web server is publishing bogus info, Manifold can't reach into the server and fix it.

I've sent in a suggestion to add forcing use of XY to the geojsonserver dataport. That's far from ideal because it's doing something wrong to fix another wrong, "two wrongs make a right". But sometimes rough justice is better than none.

joebocop
426 post(s)
online
#14-Oct-20 18:10

Thank you Dimitri.

The server is declaring EPSG4326, but is supplying coordinates in XY order. The server should instead declare nothing, or WGS84 if anything. Manifold should allow the user to fix things like this in situ; thank you for submitting.

In summary, the returned GeoJSON begins

{"type":"FeatureCollection","crs":{"type":"name","properties":{"name":"EPSG:4326"}},"features":[....

But then then coordinates are supplied in XY order

{"type":"Feature","id":1,"geometry":{"type":"Polygon","coordinates":[[[-127.11595124819743,60.586315891027667],[-127.11669728280599,60.573922319797134]....

The GeoJSON spec requires that, in the absence of a declared CRS, coordinate ordering be XY per 3.1.1 (Position):

A position is an array of numbers. There MUST be two or more elements. The first two elements are longitude and latitude, or easting and northing, precisely in that order and using decimal numbers.

I've reached out to the data provider to correct their response. Thank you.

Manifold User Community Use Agreement Copyright (C) 2007-2019 Manifold Software Limited. All rights reserved.