5

The problem is that the Chukotka Peninsula is located in the Western Hemisphere. So it is on the left side of Natural Earth Datasets. It needs to be moved to the right. I tried to use following srs(Coordinate system in which the map is rendered) - centered on 11°E :

+proj=mill +lat_0=0 +lon_0=11 +x_0=0 +y_0=0 +R_A +a=6371000 +b=6371000 +units=m +no_defs

And get this result (notice horizontal straight lines):

world

Obviously I did something wrong.

This is similar unanswered question: http://lists.berlios.de/pipermail/mapnik-users/2009-January/001497.html

I have tried some actions from there as well.

How can I get the world to wrap around a different meridian?

Do I need to process the data through org2org or something?


More images with +lon_0=+-15 :

world1 world2

Images from linked question from mailing list :

world3 world4

What's the problem with this pictures? How do I make it right?

Andrey Yankin
  • 71
  • 1
  • 8
  • Have you searched our site for similar questions? Perhaps you will find an answer is already posted. – whuber Sep 27 '13 at 15:45
  • @whuber, I believe only this question is vaguely related (using your search suggestion). And this is even farther. – Andrey Yankin Sep 27 '13 at 16:35
  • @whuber I know, I must have been missing something simple. I've searched for it, but unfortunately I could not find it. – Andrey Yankin Sep 27 '13 at 17:04
  • 1
    Could you make the horizontal lines a bit more visible? Light gray on dark gray ain't a good choice. – Jakub Kania Sep 28 '13 at 08:23
  • @JakubKania, sure, here they are – Andrey Yankin Sep 28 '13 at 08:53
  • 1
    take a look here: http://gis.stackexchange.com/questions/70411/qgis-display-world-country-shape-files-centered-on-pacific-ocean-using-robinson/70421#70421 – Kurt Sep 28 '13 at 09:27
  • @Kurt : Thanks, it is a possible solution, but I don't like it. First, it involves using GUI software and manual work. Second, Chukotka is separated from the rest of the country. I want to do it with arbitrary data and bounds and no manual preparations. Could it be possible to use similar modified technique without its limitations? – Andrey Yankin Sep 28 '13 at 09:55
  • 1
    There are several solutions here. JEQL does it only with three lines! – Antonio Falciano Sep 29 '13 at 18:14
  • @afalciano: thank you, I'll probably go that way of preparing/shifting data before rendering. Will any of those methods connect Chukotka to Asia? I am still wondering, shouldn't there be some setting to do wrapping on the final rendering stage? For example, if the point is too far away, it must add to itself +-360 (e.g current point is 178°, next is -179°. Next is too far, so we add 360 and get 181°) – Andrey Yankin Sep 29 '13 at 20:30
  • @afalciano: Oh my previous comment is not so good. Real final stage would be if we render both sides of the map and then attach them together to get wrapped map. – Andrey Yankin Sep 29 '13 at 20:36
  • @AndreyYankin Right, adding 360° would do the trick (see the answer below). Then you need only to merge the two parts if you need to render all the region without the trace of 180° meridian. – Antonio Falciano Oct 02 '13 at 16:53
  • @AndreyYankin I have updated my answer in order to cover the whole workflow. Hope this helps! – Antonio Falciano Oct 04 '13 at 15:47
  • You need to take care of the "global wraparound", e.g. GRASS GIS can handle that: http://grass.osgeo.org/uploads/images/Gallery/vector/v_hull_datum_line.png – markusN Oct 04 '13 at 18:52

1 Answers1

8

It's clear that it's not necessary to shift the projection, but the data. Using GDAL >= 1.10.0 compiled with SQLite and SpatiaLite:

ogr2ogr russia_shifted.shp world.shp -dialect sqlite -sql "SELECT ShiftCoords(geometry,360,0) FROM world WHERE CNTRY_NAME='Russia'"

where shiftX = 360 (degrees) and shiftY = 0.

enter image description here

UPDATE: here's the whole workflow...

Clip world.shp between -169° and +180° of longitude in order to exclude the Chukotka Peninsula (1st part):

ogr2ogr world_clip.shp world.shp -clipsrc -169 -90 180 90

Shift and clip world.shp between +180° and +191° of longitude in order to include the Chukotka Peninsula (2nd part):

ogr2ogr Chukotka_Peninsula.shp world.shp -dialect sqlite -sql "SELECT CNTRY_NAME, ShiftCoords(geometry,360,0) FROM world" -clipsrc 180 -90 191 90

Merge the two parts:

ogr2ogr world_shifted.shp world_clip.shp
ogr2ogr -update -append world_shifted.shp Chukotka_Peninsula.shp -nln world_shifted

Finally, dissolve countries boundaries of world_shifted.shp obtaining world_output.shp:

ogr2ogr world_output.shp world_shifted.shp -dialect sqlite -sql "select ST_Union(Geometry),CNTRY_NAME FROM world_shifted GROUP BY CNTRY_NAME"

Here's the graphical result:

enter image description here

Antonio Falciano
  • 14,333
  • 2
  • 36
  • 66
  • Thank you very much for the update. I see correct results. Unfortunately, I cannot try this solution myself now. I am using ArchLinux and it seems to not have GDAL compiled with SpatiaLite, so I get an error: no such function: ShiftCoords. I'll try to solve this technical issue soon and then I'll give a feedback if your answer suits me well. – Andrey Yankin Oct 04 '13 at 20:28