[postgis-users] Trying to import natural earth data into postgis 1.5.2

Paul Ramsey pramsey at opengeo.org
Thu Dec 30 17:00:06 PST 2010


The problem lies in the data. How to fix is... I dunno. I guess we
should keep naturalearth in our minds as we build cleaning solutions,
it appears to be an excellent collection of mucky geometry.

P

On Thu, Dec 30, 2010 at 4:03 PM, David Blackman <david at whizziwig.com> wrote:
> Hi all--
>
> I'm trying to import the 10m-admin-1 data from
> http://www.naturalearthdata.com/ to postgis 1.5.2. It's generating a
> lot of invalid geometry that I don't know how to fix.
>
> My import command looks like this:
>
> shp2pgsql -W LATIN1 -I 10m-admin-1-states-provinces-shp >
> 10m-admin-1-states-provinces-shp.sql
> (note, in postgis2, this entirely fails on invalid input characters,
> none of the character sets I tried worked)
>
> and of the import, 148 rows have invalid geometry, with errors like:
> blackmad=# select fips_1 FROM
> public."10m-admin-1-states-provinces-shp" WHERE ST_IsValid(the_geom) =
> false;
> NOTICE: Holes are nested at or near point 101.662 3.04074
> NOTICE: Self-intersection at or near point 120.185 22.9625
> NOTICE: IllegalArgumentException: Invalid number of points in
> LinearRing found 2 - must be 0 or >= 4
> NOTICE: Ring Self-intersection at or near point -47.3025 -16.0401
> NOTICE: Too few points in geometry component at or near point -65.458 -22.1012
>
> This cleangeometry.sql script @
> http://www.sogis1.so.ch/sogis/dl/postgis/cleanGeometry.sql fixes most,
> but the LinearRing errors cause the script to choke.
>
> Can someone advise me on how to fix these errors, or where the problem
> lies (in the data or the import tool)?
>
> thanks
> --dave
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>



More information about the postgis-users mailing list