2

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
4

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.

  • Hello. How do you switch to WFS 1.0.0? – Rodolphe Sep 17 at 18:11
3

The answer is yes they are both valid - which one you want depends on which version of the coordinate system and OGC standards you are using. See this page for a full discussion of the issues.

If you want to be sure of the order of your coordinates don't use epsg:4326 - check out the OGC URN's mentioned at the bottom of that page so you can be sure of what you are getting.

0

It's actually a bug in GeoServer.

GeoServer in it's WFS implementation specifies the order of coordinates for different versions and projection definitions (link) but GeoJSON states specifically that the order is always the same (x,y,z or lon,lat,alt). See the spec.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.