-1

How to have continuous features for a shapefile ? I mean NOT cut by the dateline to respect [-180:180] longitude excursion that I do not want to respect.

Here is an example where I display the Russia shapefile in a leaflet map. In fact I would like to have continuous continent.

enter image description here

Shapefile comes from https://gadm.org/about.html

Any command from gdal or ogr2ogr to merge separated features ?

Thanks

PBrockmann
  • 303
  • 5
  • 16
  • are these actually separate features? In any case, I'd guess you need to choose a projection where you don't have to deal with the wraparound. Web mercator (assuming leaflet runs this) is obviously not the choice – Val Apr 02 '21 at 07:57
  • Yes sure. But this is the way the interface has been designed. My question is rather how to modify the shapefile to have continuous shape even if they are over 180 degrees. – PBrockmann Apr 03 '21 at 13:38
  • I think it is a continuous shape. You just need the correct projection to display it – Val Apr 06 '21 at 08:01
  • No there are not... Open one in qgis and you will see. – PBrockmann Apr 06 '21 at 17:36
  • I would, but GADM data source seems to be offline (at least for me). I do have an admin-0 for RUS myself, which is indeed displayed in separate parts as is yours. But when toggling `show feature count` in `QGIS` mine displays as only one feature - which is what I'd think would GADM as well. Can you confirm that your vector file has multiple features? I'd like to check, will do once GADM is back online – Val Apr 06 '21 at 17:49
  • Only one feature – PBrockmann Apr 10 '21 at 12:09

1 Answers1

0

If you load the GADM level-0 layer into QGIS and toggle Show Feature Count, you'll see that, even though the shape seems split, the actual layer only has a single feature:

enter image description here

Your shape gets cut off because the polygon crosses the boundary in the projection you are using and gets wrapped around. This doesn't mean the features get actually split.

If you want to display it as a continuous feature, you need to specify an appropriate projection. For instance, using the example here gives me this:

enter image description here

This is just one way, there might be different projections that fit your purpose better. Also, getting this done in leaflet is a different question.

Val
  • 6,585
  • 5
  • 22
  • 52
  • Thank you for helping on this. In fact, I would really like having a continuous shapefile even if I represent it in a EPSG:3857 used by Leaflet by default. See the map displayed in my question. – PBrockmann Apr 10 '21 at 12:10
  • @PBrockmann Fair enough, in my opinion, this is not possible. – Val Apr 10 '21 at 16:25