3

I've generate the GeoJson below, but I'm not able to display it on map, neither on http://geojson.io/. I'm pretty sure it depends from my GeoJson but i don't understand why. What am i doing wrong?

{
    "features": [
        {
            "geometry": {
                "coordinates": [
                    [
                        [
                            7987535.713063609,
                            16542238.901992338
                        ],
                        [
                            7987535.713063609,
                            16413269.03785025
                        ],
                        [
                            8116090.883108776,
                            16413269.03785025
                        ],
                        [
                            8116090.883108776,
                            16542238.901992338
                        ],
                        [
                            7987535.713063609,
                            16542238.901992338
                        ]
                    ]
                ],
                "type": "Polygon"
            },
            "properties": {
                "raster_val": "-24.00"
            },
            "type": "Feature"
        }
    ],
    "type": "FeatureCollection"
}
Davide Raro
  • 116
  • 8

1 Answers1

5

The GeoJSON specification requires GeoJSON data to be EPSG:4326 (WGS 84).

Your coordinates are not WGS 84. So you need to transform your data when creating the GeoJSON. Then you can just copy it into geojson.io and it will work fine.

Note that some software (e.g. QGIS) are able to save GeoJSON in any coordinate system whatsoever. This is due to the specification not always having limited GeoJSONs to WGS 84. But when creating a GeoJSON these days you should always create it in WGS 84, even if the software you are using lets you read/write it in other coordinate systems.

Especially when you use GeoJSON in web mapping this is important, as most libraries will reject it if it is not WGS 84.

BritishSteel
  • 6,637
  • 4
  • 38
  • 64
  • Thanks, I was suspecting it. – Davide Raro Jan 20 '21 at 08:39
  • 3
    GeoJSON is not EPSG:4326, GeoJSON is CRS:84. They have different axis order (lat/long vs. long/lat) WGS84 datum cited is not EPSG:4326, it tells you beneath that this is equivalent to the coordinate reference system identified by the Open Geospatial Consortium (OGC) URN urn:ogc:def:crs:OGC::CRS84. – nmtoken Jan 20 '21 at 11:01