[GIS] Is GeoServer getting coordinate output in GeoJSON WFS wrong

coordinate systemgeojsongeoserverwfs

When I do a WFS request to GeoServer and specify the SRS like this:

http://myserver.com/geoserver/wfs?
    service=WFS&
    version=2.0.0&
    request=GetFeature&
    outputFormat=application/json&
    srsName=EPSG:4326&
    typeName=MYWORKSPACE:mylayer&

I get exactly what I expect and it works fine.

When I remove the srsName=EPSG:4326 parameter I get GeoJSON that still identifies itself with:

"crs": {
    "type": "EPSG",
    "properties": {
        "code": "4326"
    }
}

but the order of the coordinates is reversed, so it doesn't work.

Are both of these valid EPSG:4326 output, or is one of them wrong?

The layer I'm working with has these settings:

  • Native SRS: EPSG:4283
  • Declared SRS: EPSG:4326
  • SRS handling: Reproject native to declared

Best Answer

The short answer is that Geoserver confirms to the WFS Spec, which specifies the coordinate order like as; WFS 1.0.0 - longitude/latitude (x/y) WFS 1.1.0 - latitude/longitude (y/x) WFS 2.0.0 - latitude/longitude (y/x)

See http://docs.geoserver.org/stable/en/user/services/wfs/basics.html#axis-ordering

I'm using Leaflet. Switching to WFS 1.0.0 was way easier than some messy javascript workaround.