[postgis-users] Invalid Geometry problem
Paul Ramsey
pramsey at opengeo.org
Mon Nov 5 12:29:56 PST 2012
You may have to upgrade to 1.5 (or perhaps just the latest 1.4
release) to get around an overly strict set of rules around geometry
validity that had a brief reign in the 1.4 series. The rules included
things like not accepting unclosed rings (fine) and not emitting
unclosed rings (whoa, nelly, that's a bit too strict).
P.
On Mon, Nov 5, 2012 at 12:16 PM, Brian Peschel <brianp at occinc.com> wrote:
> I am having a problem that I can't explain.
>
> I have a 2 node Slony DB system.
> Node 1: Ubuntu 10, Postgres 8.4.13-0ubuntu10.04, PostGIS 1.4.0-2, libgeos
> 3.1.0-1
> Node 2: Ubuntu 10, Postgres 8.4.3-1, PostGIS 1.4.0-2, libgeos 3.1.0-1
>
> I have a polygon geometric in my database:
>
> Table "public.table"
> Column | Type | Modifiers
> ---------------+---------------+-----------
> id | integer | not null
> geom | geometry |
> Indexes:
> "tbl_geom_idx" gist (geom)
> Check constraints:
> "enforce_dims_geom" CHECK (ndims(geom) = 2)
> "enforce_srid_geom" CHECK (srid(geom) = 4269)
>
> Which works just fine on Node1:
> select st_astext(geom) from table where rid = 1;
>
> POLYGON((-94.3043033 38.8722515,-94.3047635 38.8672929,-94.303613
> 38.8674323,-94.3028972 38.868209,-94.3015677 38.8682687,-94.3001871
> 38.8684878,-94.2983464 38.8695432,-94.2968124 38.869583,-94.2952273
> 38.8696826,-94.2948182 38.8699813,-94.2946392 38.8704393,-94.2944858
> 38.8706385,-94.2938722 38.8706783,-94.2933609 38.8706385,-94.2923127
> 38.8706385,-94.2919548 38.8708774,-94.2917758 38.8711164,-94.2917247
> 38.8717138,-94.30167 38.8721121,-94.3040732 38.872132,-94.3043033
> 38.8722515))
>
> But if I try the same thing on Node 2:
> select st_astext(geom) from table where rid = 1;
>
> ERROR: geometry contains non-closed rings
>
> And in my postgres log:
> 2012-11-02 15:23:24 CDT ERROR: geometry contains non-closed rings
> 2012-11-02 15:23:24 CDT STATEMENT: select st_astext(geom) from table where
> rid = 1;
>
> But I can can select the points individually on Node 2:
> select 100 + generate_series(1, ST_npoints(geom)-1) as sequence,
> ST_Y(pointn(ExteriorRing(geom), generate_series(1,
> ST_npoints(geom)-1)))::numeric(10,7) as lat, ST_X(pointn(ExteriorRing(geom),
> generate_series(1, ST_npoints(geom)-1)))::numeric(10,7) as lon from table
> where id = 1 order by 1;
>
> sequence | lat | lon
> ----------+------------+-------------
> 101 | 38.8722515 | -94.3043033
> 102 | 38.8672929 | -94.3047635
> 103 | 38.8674323 | -94.3036130
> 104 | 38.8682090 | -94.3028972
> 105 | 38.8682687 | -94.3015677
> 106 | 38.8684878 | -94.3001871
> 107 | 38.8695432 | -94.2983464
> 108 | 38.8695830 | -94.2968124
> 109 | 38.8696826 | -94.2952273
> 110 | 38.8699813 | -94.2948182
> 111 | 38.8704393 | -94.2946392
> 112 | 38.8706385 | -94.2944858
> 113 | 38.8706783 | -94.2938722
> 114 | 38.8706385 | -94.2933609
> 115 | 38.8706385 | -94.2923127
> 116 | 38.8708774 | -94.2919548
> 117 | 38.8711164 | -94.2917758
> 118 | 38.8717138 | -94.2917247
> 119 | 38.8721121 | -94.3016700
> 120 | 38.8721320 | -94.3040732
> (20 rows)
>
> So I am stumped. I do see this on node 2:
> select st_isvalid(geom), st_isvalidreason(geom) from message_locate_polygon
> where id = 1;
> NOTICE: IllegalArgumentException: points must form a closed linestring
> NOTICE: IllegalArgumentException: points must form a closed linestring
> ERROR: POSTGIS2GEOS conversion failed
>
> Any thoughts? I suspect that upgrading postgres on node 2 would solve it,
> but I since I don't know the cause of the error, I am still concerned.
>
> Thanks in advance,
>
> - B
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
More information about the postgis-users
mailing list