3

I am currently exporting a geojson data from qgis to mapbox studio. My area map covers and crosses the 180 degree line across the Pacific ocean. I tried exporting using CRS setting EPSG:4326 and EPSG:3832 (Pacific Disaster Center) to no luck as both settings cuts and only shows the first half of the area.

Is there a way that I can export the geojson without being cut off?

enter image description here

Area should be this:

enter image description here

4
  • Does QGIS export one polygon that crosses the dataline or two halves?
    – user30184
    Dec 7, 2020 at 11:20
  • @user30184 I tried opening the one I exported from QGIS and it showed a complete shape and also I don't know yet how to manually split it in half. Checking the geojson output code itself, I can see that it's grouped in a single piece, not half. Dec 7, 2020 at 13:19
  • Try this: in QGIS use layer - save as, then select format geojson (not the newline delimited). Change option RFC7946 into YES. If that does not help then saving GeoJSON into temporary file and converting it into new one with ogr2ogr by using option ´-wrapdateline` should split the geometry.
    – user30184
    Dec 7, 2020 at 13:34
  • @user30184 The RFC7946 into YES setting did work. Thank you! Dec 7, 2020 at 14:26

1 Answer 1

6

By the GeoJSON specification geometries which are crossing the dateline are not strictly forbidden but it is recommended that they are cut in two halves.

https://www.rfc-editor.org/rfc/rfc7946

In representing Features that cross the antimeridian,
interoperability is improved by modifying their geometry. Any
geometry that crosses the antimeridian SHOULD be represented by
cutting it in two such that neither part's representation crosses the antimeridian.

The original GeoJSON specification did not include the rule of splitting the geometries by the dateline. Selecting option RFC7946 YESforces QGIS to use the current specification and splitting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.