[gdal-dev] splitting along 180

Sina Bahram sbahram at nc.rr.com
Tue Jul 31 08:36:34 PDT 2012

I was wondering if this isn't the right list for the below question, where would you folks recommend I ask?

Thanks much

Take care,

Website: www.SinaBahram.com
Twitter: @SinaBahram

-----Original Message-----
From: Sina Bahram [mailto:sbahram at nc.rr.com] 
Sent: Monday, July 30, 2012 12:18 AM
To: 'gdal-dev at lists.osgeo.org'
Subject: splitting along 180


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

I have a dataset of country borders which I obtained from:

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

#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,

Website: www.SinaBahram.com
Twitter: @SinaBahram

More information about the gdal-dev mailing list