<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<div class="moz-text-html" lang="x-unicode">
<p>Hi, <br>
</p>
<p>I have a problem with reprojecting a global GeoJSON file with a hole over Canada from EPSG:4326 to EPSG:3978 (Canada Atlas Lambert).</p>
<p>You can see my GeoJSON below in this email. The global extent is x=-180,180 and y=-90,90<br>
</p>
<p>I tried using:</p>
<ul>
<li>MapServer (7.4.4)<br>
<ul>
<li>I tried to serve the layer as WMS and display it in QGIS </li><li>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.<br>
</li></ul>
</li><li>Opening raw GeoJSON directly in QGIS (3.15.0-Master, GDAL 3.2.0dev, PROJ 7.2.0)<br>
<ul>
<li>same results as MapServer in WMS<br>
</li></ul>
</li><li>ogr2ogr (GDAL 3.0.4)
<ul>
<li>I tried to reproject the GeoJSON from EPSG:4326 to EPSG:3978 </li><li>Result: the reprojection failed, my feature is empty<br>
<ul>
<li><i>ogr2ogr -f "GeoJSON" -s_srs EPSG:4326 -t_srs EPSG:3978 18-3978.geojson 17-4326.geojson</i><i><br>
</i><i>ERROR 1: Full reprojection failed, but partial is possible if you define OGR_ENABLE_PARTIAL_REPROJECTION configuration option to TRUE</i><i><br>
</i><i>ERROR 1: Failed to reproject feature 0 (geometry probably out of source or destination SRS).</i><i><br>
</i><i>ERROR 1: Terminating translation prematurely after failed</i><i><br>
</i><i>translation of layer 17-4326 (use -skipfailures to skip errors)</i> </li></ul>
</li></ul>
</li><li>OpenLayers and the proj4 lib (proj4js/2.6.2/proj4.js)
<ul>
<li>Here is an example reprojecting the GeoJSON to EPSG:3978: <a href="https://codepen.io/rousseaulambertlp/pen/wvGGBXd">
https://codepen.io/rousseaulambertlp/pen/wvGGBXd</a>
<ul>
<li>The OSM base map is reprojected corretly, but the GeoJSON is simply not displayed
</li></ul>
</li><li>Here is the same code, but using a non global GeoJSON with a hole, which works:
<a href="https://codepen.io/rousseaulambertlp/pen/YzqWVBZ">https://codepen.io/rousseaulambertlp/pen/YzqWVBZ</a>
</li><li>But I see that a global WMS layer served from MapServer, works fine in this projection:
<a href="https://codepen.io/rousseaulambertlp/pen/MWyeogM">https://codepen.io/rousseaulambertlp/pen/MWyeogM</a>
</li></ul>
</li></ul>
<p>My guess is these behaviors are caused by the proj library giving I have issues in all the examples above ?<br>
</p>
<p>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) ?</p>
<p>Any idea of work around other then clipping the data to the EPSG:3978 extent ?</p>
<p>Thanks</p>
<p>LP<br>
</p>
<p>Here is the GeoJSON I used for example:</p>
<p>{<br>
  "type": "FeatureCollection",<br>
  "crs": {<br>
    "type": "name",<br>
    "properties": {<br>
      "name": "EPSG:4326"<br>
    }<br>
  },<br>
  "features": [<br>
    {<br>
     "type": "Feature",<br>
     "properties": {<br>
      "name": "test"<br>
      },<br>
      "geometry": {<br>
        "type": "Polygon",<br>
        "coordinates": [<br>
          [<br>
            [-180, -90],<br>
            [-180, 90],<br>
            [180, 90],<br>
            [180, -90],<br>
            [-180, -90]<br>
            ],<br>
            [[-160, 50],<br>
            [-160, 60],<br>
            [-70, 60],<br>
            [-70, 50],<br>
            [-160, 50]<br>
          ]<br>
        ]<br>
      }<br>
    }<br>
  ]<br>
}<br>
</p>
</div>
</body>
</html>