[postgis-users] Bogus unknown geometry error from ST_Transform

Paul Ramsey pramsey at opengeo.org
Sun Feb 19 12:35:47 PST 2012


A bug is unspecified or unexpected behavior, and I'm afraid your case is
neither: the system is operating exactly as I would expect. You have
outlined what might be considered a legitimate enhancement, but it's on the
edge, because do-what-I-mean-not-what-I-say behavior can cause other people
problems from time to time.

P.

On Sun, Feb 19, 2012 at 12:29 PM, Aren Cambre <aren at arencambre.com> wrote:

> OK, I figured out the second error. The TIGER places dataset for Texas has
> both POLYGON and MULTIPOLYGON types, hence violating the *
> enforce_geotype_the_geom_3081* constraint.
>
> However, I think the original issue is a bug. If the geometry object has
> no SRID specified, as in my case, then ST_Transform should use whatever's
> specified in *public.geometry_columns*. I should not be getting errors
> about SRID of -1 if something is specified in  *public.geometry_columns*.
>
> Aren
>
> On Sun, Feb 19, 2012 at 9:13 AM, Aren Cambre <aren at arencambre.com> wrote:
>
>> Nope. BTW, there is an extraneous parenthesis in your example. Here's
>> what I used:
>> *UPDATE gis."gz_2010_48_160_00_500k"*
>> *SET "the_geom_3081" = ST_Transform(ST_Setsrid(the_geom, 4629),3081);*
>>
>> (BTW, I said 4326 earlier, but I should have been using 4269. Not sure
>> that explains the errors, however.)
>>
>> Now I get this:
>> *ERROR: new row for relation "gz_2010_48_160_00_500k" violates check
>> constraint "enforce_geotype_the_geom_3081"*
>>
>> This is just bizarre because the source and destination column are
>> POLYGON types.
>>
>> Here's what I get when running *ST_AsEWKT(the_geom)*:
>> *"POLYGON((-94.940569 29.330815,-94.93334 29.329038,-94.930971
>> 29.327708,-94.929679 29.32634,-94.938834 29.320412,-94.946644
>> 29.323065,-94.946988 29.326066,-94.94085 29.330469,-94.940569 29.330815))"
>> *
>>
>> I just double-checked, and there are no other rows in
>> public.geometry_columns describing anything in the *
>> gz_2010_48_160_00_500k* table besides the two rows I pasted earlier.
>>
>> Here's that constraint:
>> *enforce_geotype_the_geom_3081 CHECK (geometrytype(the_geom_3081) =
>> 'POLYGON'::text OR the_geom_3081 IS NULL);*
>>
>> Aren
>>
>> On Sun, Feb 19, 2012 at 2:10 AM, <pcreso at pcreso.com> wrote:
>>
>>> Does this work?
>>>
>>> *UPDATE gis."gz_2010_48_160_00_500k"*
>>> *SET "the_geom_3081" = ST_Transform((ST_Setsrid(the_geom, 4326),3081);*
>>>
>>> ie:: is the problem finding the srid from geometry_columns or finding it
>>> but ST_Transform() fails even when given the srid?
>>>
>>> Even if there is a bug, this may work for you until fixed?
>>>
>>> Brent Wood
>>>
>>> --- On *Sun, 2/19/12, René Romero Benavides <ichbinrene at gmail.com>*wrote:
>>>
>>>
>>> From: René Romero Benavides <ichbinrene at gmail.com>
>>> Subject: Re: [postgis-users] Bogus unknown geometry error from
>>> ST_Transform
>>> To: postgis-users at postgis.refractions.net
>>> Date: Sunday, February 19, 2012, 8:37 PM
>>>
>>>
>>>  El 18/02/2012 11:29 p.m., Aren Cambre escribió:
>>>
>>> ST_Transform is returning a bogus error of* Input geometry has unknown
>>> (-1) SRID*.
>>>
>>>  Here's the query:
>>>  *UPDATE gis."gz_2010_48_160_00_500k"*
>>> *SET "the_geom_3081" = ST_Transform(the_geom, 3081);*
>>>
>>>  I said "bogus" because the database's *public.geometry_columns* table
>>> has valid values for these two columns, and neither has SRID of -1:
>>>  *34281;"''";"gis";"gz_2010_48_160_00_500k";"the_geom";2;4326;"POLYGON"*
>>> *
>>> 34276;"''";"gis";"gz_2010_48_160_00_500k";"the_geom_3081";2;3081;"POLYGON"
>>> *
>>>
>>>  What gives?
>>>
>>>  Aren
>>>
>>>
>>> _______________________________________________
>>> postgis-users mailing listpostgis-users at postgis.refractions.net <http://mc/compose?to=postgis-users@postgis.refractions.net>http://postgis.refractions.net/mailman/listinfo/postgis-users
>>>
>>>  I thought a SRID of -1 was a synonym for the default one (4326). But
>>> don't take my word for it, I'm beginning with postgis.
>>> --
>>>  http://sharingtechknowledge.blogspot.com/
>>>
>>> -----Inline Attachment Follows-----
>>>
>>>
>>> _______________________________________________
>>> postgis-users mailing list
>>> postgis-users at postgis.refractions.net<http://mc/compose?to=postgis-users@postgis.refractions.net>
>>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>>
>>>
>>> _______________________________________________
>>> postgis-users mailing list
>>> postgis-users at postgis.refractions.net
>>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>>
>>>
>>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120219/539bdc63/attachment.html>


More information about the postgis-users mailing list