[PROJ] Issue with global GeoJSON in EPSG:3978

Kristian Evers kreve at sdfe.dk
Tue Aug 18 05:02:24 PDT 2020


I  haven't digged very deep into this but I can identify at least two things that seem problematic to me.

EPSG:3978 is only defined in Canada. It is based on NAD83, so expecting a global dataset to be transformed to that CRS is asking a bit much.

> The OSM base map is reprojected corretly, but the GeoJSON is simply not displayed

Is it though? I see two occurrences of India and as far as I am aware only one exist in real life.

I would try to find a CRS that is better suited for your particular use case.

/Kristian

From: PROJ <proj-bounces at lists.osgeo.org> On Behalf Of Rousseau Lambert2, Louis-Philippe (EC)
Sent: 18. august 2020 13:42
To: proj at lists.osgeo.org
Subject: [PROJ] Issue with global GeoJSON in EPSG:3978


Hi,

I have a problem with reprojecting a global GeoJSON file with a hole over Canada from EPSG:4326 to EPSG:3978 (Canada Atlas Lambert).

You can see my GeoJSON below in this email. The global extent is x=-180,180 and y=-90,90

I tried using:

  *   MapServer (7.4.4)

     *   I tried to serve the layer as WMS and display it in QGIS
     *   Result: I expected the GeoJSON to be automatically cut to the EPSG:3978 extent and show the hole over Canada, but instead, the hole was displayed as the features on the map whitout the global extent.

  *   Opening raw GeoJSON directly in QGIS (3.15.0-Master, GDAL 3.2.0dev, PROJ 7.2.0)

     *   same results as MapServer in WMS

  *   ogr2ogr (GDAL 3.0.4)

     *   I tried to reproject the GeoJSON from EPSG:4326 to EPSG:3978
     *   Result: the reprojection failed, my feature is empty

        *   ogr2ogr -f "GeoJSON" -s_srs EPSG:4326 -t_srs EPSG:3978 18-3978.geojson 17-4326.geojson
ERROR 1: Full reprojection failed, but partial is possible if you define OGR_ENABLE_PARTIAL_REPROJECTION configuration option to TRUE
ERROR 1: Failed to reproject feature 0 (geometry probably out of source or destination SRS).
ERROR 1: Terminating translation prematurely after failed
translation of layer 17-4326 (use -skipfailures to skip errors)

  *   OpenLayers and the proj4 lib (proj4js/2.6.2/proj4.js)

     *   Here is an example reprojecting the GeoJSON to EPSG:3978: https://codepen.io/rousseaulambertlp/pen/wvGGBXd

        *   The OSM base map is reprojected corretly, but the GeoJSON is simply not displayed

     *   Here is the same code, but using a non global GeoJSON with a hole, which works: https://codepen.io/rousseaulambertlp/pen/YzqWVBZ
     *   But I see that a global WMS layer served from MapServer, works fine in this projection: https://codepen.io/rousseaulambertlp/pen/MWyeogM

My guess is these behaviors are caused by the proj library giving I have issues in all the examples above ?

So I wanted to know if this is expected behavior, giving I'm trying to display a global features on a projection with a smaller extent ? Or is this is bug (especially the inverted feature in QGIS) ?

Any idea of work around other then clipping the data to the EPSG:3978 extent ?

Thanks

LP

Here is the GeoJSON I used for example:

{
  "type": "FeatureCollection",
  "crs": {
    "type": "name",
    "properties": {
      "name": "EPSG:4326"
    }
  },
  "features": [
    {
     "type": "Feature",
     "properties": {
      "name": "test"
      },
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [-180, -90],
            [-180, 90],
            [180, 90],
            [180, -90],
            [-180, -90]
            ],
            [[-160, 50],
            [-160, 60],
            [-70, 60],
            [-70, 50],
            [-160, 50]
          ]
        ]
      }
    }
  ]
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20200818/595b94fb/attachment-0001.html>


More information about the PROJ mailing list