[postgis-users] Bogus unknown geometry error from ST_Transform

Aren Cambre aren at arencambre.com
Sun Feb 19 07:07:51 PST 2012


I just ran this:
*SELECT ST_AsEWKT(the_geom)*
*FROM gis."gz_2010_48_160_00_500k"*
*LIMIT 1;*

Here's what I get:
*"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))"*

So it appears that SRID is in fact not embedded?

This PostGIS dataset was imported from a SHP using Quantum GIS's SPIT. SPIT
did not set a value for *the_geom* in *public.geometry_columns*--I believe
it can, but I didn't specify any options to do that.

I added a row for the *the_geom* field using the code recommended in the
PostGIS online instructions:
*INSERT INTO geometry_columns(f_table_catalog, f_table_schema,
f_table_name, f_geometry_column, coord_dimension, srid, "type")*
*SELECT '', 'gis', 'gz_2010_48_160_00_500k', 'the_geom',
ST_CoordDim(the_geom), ST_SRID(the_geom), GeometryType(the_geom)*
*FROM gis.gz_2010_48_160_00_500k LIMIT 1;*

And when I do that, the SRID in the table is *-1*, so yes, I have to
manually change to *4326*.

So maybe ST_Transform doesn't reference the *public.geometry_columns* table
after all? Seems like it ought to if the SRID isn't contained in the
geometry object.

By the way, the original SHP is *EPSG:4269 - NAD83* per Quantum GIS. (Oops,
I was using 4326 previously, but not sure that explains the errors.)

Aren

On Sun, Feb 19, 2012 at 8:54 AM, Stephen Woodbridge <woodbri at swoodbridge.com
> wrote:

> SRID=-1 means that the geometry SRID is unknown or has no SRID. This is
> NOT synonym got 4326.
>
> Also, every geometry has an SRID embedded in it. If all you did is change
> the value in the public.geometry_columns table then you have NOT changed
> the geometry's SRID and the SRID of the geometry is the only thing that is
> looked at by the ST_* functions.
>
> -Steve
>
>
> On 2/19/2012 3: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<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 list
>>>    postgis-users at postgis.**refractions.net<postgis-users at postgis.refractions.net> </mc/compose?to=
>>> postgis-users@**postgis.refractions.net<postgis-users at postgis.refractions.net>
>>> >
>>>    http://postgis.refractions.**net/mailman/listinfo/postgis-**users<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/<http://sharingtechknowledge.blogspot.com/>
>>
>>    -----Inline Attachment Follows-----
>>
>>    ______________________________**_________________
>>    postgis-users mailing list
>>    postgis-users at postgis.**refractions.net<postgis-users at postgis.refractions.net>
>>    </mc/compose?to=postgis-users@**postgis.refractions.net<postgis-users at postgis.refractions.net>
>> >
>>    http://postgis.refractions.**net/mailman/listinfo/postgis-**users<http://postgis.refractions.net/mailman/listinfo/postgis-users>
>>
>>
>>
>>
>> ______________________________**_________________
>> postgis-users mailing list
>> postgis-users at postgis.**refractions.net<postgis-users at postgis.refractions.net>
>> http://postgis.refractions.**net/mailman/listinfo/postgis-**users<http://postgis.refractions.net/mailman/listinfo/postgis-users>
>>
>
> ______________________________**_________________
> postgis-users mailing list
> postgis-users at postgis.**refractions.net<postgis-users at postgis.refractions.net>
> http://postgis.refractions.**net/mailman/listinfo/postgis-**users<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/6d6aae3a/attachment.html>


More information about the postgis-users mailing list