Skip to content

Features endpoint swap x and y coordinates when using EPSG CRS #2010

@mikemahoney218-usgs

Description

@mikemahoney218-usgs

Description

When providing no CRS or using OGC CRS strings, pygeoapi returns coordinates in (the correct) x, y order:

curl https://demo.pygeoapi.io/master/collections/dutch_windmills/items?f=json&limit=1&crs=http://www.opengis.net/def/crs/OGC/1.3/CRS84
{
    "type":"FeatureCollection",
    "features":[
        {
            "type":"Feature",
            "geometry":{
                "type":"Point",
                "coordinates":[
                    5.092297735992092,
                    52.17198007698048
                ]
            },
            "properties":{ <snip> },
            "id":"Molens.1"
        }
    ],
    "links":[ <snip> ],
    "timeStamp":"2025-05-09T16:56:46.236376Z"
}

Using an EPSG CRS (which the docs list) flips these to y, x order:

curl https://demo.pygeoapi.io/master/collections/dutch_windmills/items?f=json&limit=1&crs=http://www.opengis.net/def/crs/EPSG/0/4326 
{
    "type":"FeatureCollection",
    "features":[
        {
            "type":"Feature",
            "geometry":{
                "type":"Point",
                "coordinates":[
                    52.17198007698048,
                    5.092297735992092
                ]
            },
            "properties":{ <snip> },
            "id":"Molens.1"
        }
    ],
    "links":[ <snip> ],
    "timeStamp":"2025-05-09T16:57:17.131157Z"
}

Steps to Reproduce
Steps to reproduce the behavior:

Query a Features collection with crs set to an EPSG CRS.

Expected behavior
A clear and concise description of what you expected to happen.

Coordinates in GeoJSON objects should be in x, y order.

Environment

  • pygeoapi version: 0.20.dev0

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions