[postgis-users] Questions about using SRID not -1 (SOLVED !!!)

Oscar Zamudio cmntlk at gmail.com
Thu Jan 21 16:29:23 PST 2010


Hi Christian,
Thanks to your guide finally I could do what I wanted to.
1- The query

SELECT * FROM geometry_columns;

Returned no data showing my the_geom column was not registered in
geometry_columns as you suspected.

2- I created a new geometry column:

SELECT AddGeometryColumn( 'mypoints', 'the_geom_4326', 4326, 'POINT', 2);

that was Ok as I checked that it was registered in geometry_columns table

3-Load the data from the_geom column to the new one the_geom_4326

UPDATE mypoints SET the_geom_4326 = ST_SetSRID(the_geom,4326);

4-Check all the data entered in the_geom_4326 are with the right SRID:

select st_srid(the_geom) from mypoints;

which shown that everything is Ok.

5-Check that the points in the new column have the right data:

Select st_xmin(the_geom), st_ymin(the_geom) from mypoints


 6-Drop the_geom column and rename the_geom_4326 to the_geom
6-Calculate distances in meters. An example

SELECT ST_Distance(ST_Transform(the_geom,22171),
ST_Transform(ST_GeomFromText('POINT(-58.0 0.0)', 4326),22171)) from mypoints

which returns the right results.

Thanks again Christian and everybody in the mail list for helping people to
learn PostGIS.

Regards,

Mario



On Thu, Jan 21, 2010 at 6:49 PM, Chris Hermansen <
chris.hermansen at timberline.ca> wrote:

> SELECT * FROM geometry_columns;
>
> if your table is in there, you will see a line that contains its name in
> f_table_name and its geometry column in f_geometry_column.  You don't need
> to guess.  Check its SRID there.
>
> You have some spatial queries that work ok with an SRID of -1.  Things like
> st_transform() don't work with an unknown SRID (which is what a -1 means).
>  AFAIK some of these operations need a row in geometry_columns.
>
>
> Oscar Zamudio wrote:
>
>> How can I test if it is not registered?. Nevertheless all the other
>> spatial queries are working well (ST_distanc for example) so I guess it is
>> registered. On the contrary ther will be no access to this kind of
>> operations.
>>
>> On Thu, Jan 21, 2010 at 5:24 PM, Chris Hermansen <
>> chris.hermansen at timberline.ca <mailto:chris.hermansen at timberline.ca>>
>> wrote:
>>
>>    Maybe your column is not registered in geometry_columns?
>>    Chris Hermansen        chris.hermansen at timberline.ca
>>    <mailto:chris.hermansen at timberline.ca>
>>
>>    tel+1.604.714.2878 · fax+1.604.733.0631 · mob+1.778.840.4625
>>    Timberline Natural Resource Group · www.timberline.ca
>>    <http://www.timberline.ca>
>>
>>    401 · 958 West 8th Avenue  · Vancouver BC · Canada · V5Z 1E5
>>
>>
>>    -----Original Message-----
>>    From: Oscar Zamudio <cmntlk at gmail.com <mailto:cmntlk at gmail.com>>
>>    Date: Thu, 21 Jan 2010 17:14:59
>>    To: PostGIS Users Discussion<postgis-users at postgis.refractions.net
>>    <mailto:postgis-users at postgis.refractions.net>>
>>    Subject: Re: [postgis-users] Questions about using SRID not -1
>>
>>    _______________________________________________
>>    postgis-users mailing list
>>    postgis-users at postgis.refractions.net
>>    <mailto:postgis-users at postgis.refractions.net>
>>
>>    http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>>    _______________________________________________
>>    postgis-users mailing list
>>    postgis-users at postgis.refractions.net
>>    <mailto:postgis-users at postgis.refractions.net>
>>
>>    http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>>
>>
>
> --
> Regards,
>
> Chris Hermansen · chris.hermansen at timberline.ca · skype:clhermansen
>
> tel+1.604.714.2878   ·  fax+1.604.733.0631   ·   mob+1.778.840.4625
> Timberline Natural Resource Group Ltd   ·  http://www.timberline.ca
>
> 401  ·  958 West 8th Avenue  ·  Vancouver BC  ·  Canada  ·  V5Z 1E5
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20100121/4acce017/attachment.html>


More information about the postgis-users mailing list