[gdal-dev] splitting along 180

Sina Bahram sbahram at nc.rr.com
Sun Jul 29 21:18:25 PDT 2012


Hello,

I hope this is the right list for this question. If not, then my apologies and sincere thanks in advance for knowing what list might
be.

I have a dataset of country borders which I obtained from:
http://thematicmapping.org/downloads/world_borders.php/

I have that dataset in both shp and SQL, but I'll put out there that I don't feel that affects my problem; however, please let me
know if does/can.

Because I'll be displaying those borders in something that uses Google Maps, I've got a problem. That problem is that countries
whose polygons cross 180 degrees are displaying extremely weird in Google Maps. Either it's splitting them completely wrong, taking
them all the way across the map, whatever the weirdness might be.

So, I thought I can simply address this by splitting the polygons of the countries that cross the line so that no country contains a
polygon that presents a problem. Examples of such countries/regions would be Russia and Antarctica.

I therefore invoked the following:
ogr2ogr -wrapdateline -t_srs EPSG:4326 new countryBorders.sql

I got:
ERROR 1: TopologyException: found non-noded intersection between LINESTRING (-59.7742 -72.9003, -59.8494 -73.2331) and LINESTRING (0
-73.1221, -89.3211 -73.0542) at -59.8141 -73.0766
ERROR 1: TopologyException: found non-noded intersection between LINESTRING (-59.7742 -72.9003, -59.8494 -73.2331) and LINESTRING
(180 -73.2589, -89.3211 -73.0542) at -59.8141 -73.0766

A few questions:

#1: am I even doing this the right way? for example, I find it odd that I have to provide ogr2ogr the same srs as of the input. Is
that translation even needed? Is that even the right SRS to use? I obtained that SRS from taking the proj and looking it up on this
site:
http://prj2epsg.org/search

#2: all I want is for a few of the polygons of those few troublesome countries to get split so they don't cause any more problems.
-wrapdateline seemed like the perfect solution ... maybe it's not?

I'm completely open to advice, suggestions, references, whatever.

Thanks so much in advance.

Take care,
Sina

Website: www.SinaBahram.com
Twitter: @SinaBahram





More information about the gdal-dev mailing list