[PROJ] Issue with global GeoJSON in EPSG:3978

Rousseau Lambert2, Louis-Philippe (EC) louis-philippe.rousseaulambert2 at canada.ca
Tue Aug 18 04:42:03 PDT 2020


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/ac6e1316/attachment.html>


More information about the PROJ mailing list