[postgis-users] Invalid Geometry problem (Paul Ramsey)

Brian Peschel brianp at occinc.com
Wed Nov 7 12:51:03 PST 2012


The query to show a point at a time is explicitly skipping the repeated 
last point by using

ST_npoints(geom)-1


I guess I will try upgrading Postgres and see if that fixes the problem.

Thanks!

- B

On 11/07/2012 02:00 PM, postgis-users-request at lists.osgeo.org wrote:
> Looking more closely, your node 2 polygon has 20 points and your node
> 1 polygon has 21. The point node 2 is missing is the closing vertex,
> hence the unclosed error.
>
> Now, how/why that could have happened seems a great mystery to me.
>
> P.
>
> On Mon, Nov 5, 2012 at 12:16 PM, Brian Peschel <brianp at occinc.com> wrote:
<snip>
>> 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))
<snip>
>> 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)



More information about the postgis-users mailing list