[postgis-users] Re: SRID for USA_Lambert_Conformal_Conic

P Kishor punkish at eidesis.org
Sun Aug 20 10:14:07 PDT 2006


Never mind... I think I got it. For the archives, here is what I
believe the sequence of logic --

1. spatial_ref_sys table holds all the possible spatial reference
systems (srs) I can use. So, go add in entry in it for your SRS. This
will give you a unique SRID to work with.

2. geometry_columns tables holds all the spatial tables, and their
associated SRID (fk). So, go add entries (or UPDATE) in this table for
each of the spatial tables and their SRIDs retreived from the
spatial_ref_sys table.

3. If a spatial table is already in a particular projection, but its
SRID is out-of-sync (not what it should be), all you have to do is to
update its metadata. You can do that using SetSRID() command, which
doesn't really change any coords -- it just tells the coords what SRS
they are in. Use this command like so
  UPDATE your_spatial_table
  SET the_geom = SetSRID(
    the_geom, (
        SELECT srid
        FROM geometry_columns
        WHERE f_table_name = 'your_spatial_table'
    )
  )

4. If a spatial table is in a different projection from what you want,
update its geometry permanently by doing so
  UPDATE your_spatial_table
  SET the_geom = Transform(
    the_geom, (
        SELECT srid
        FROM geometry_columns
        WHERE f_table_name = 'your_spatial_table'
    )
  )


Am I correct?


On 8/20/06, P Kishor <punkish at eidesis.org> wrote:
> Thanks Steve.
>
> On 8/20/06, Stephen Woodbridge <woodbri at swoodbridge.com> wrote:
> ..
> > 1) a table say abc the has data the is already in this projection but
> > the srid=-1, for this table:
> >
> > update abc set the_geom=setsrid(the_geom, 102005);
>
> Table 'abc' was created by importing a Shapefile via the shp2pgsql |
> psql dance. This shapefile was already in the correct projection, but
> on import into PostGIS, its SRID was set to -1 (my bad). So, to
> confirm what you are suggesting -- all I have to do for this one is to
> SetSRID() as you mention above. Should I not also update the
> geometry_columns entry for this table with the correct SRID (102005)
> or will the above UPDATE command do that for me?
>
>
> >
> > and another table say def that has data in srid=4326
> >
> > update table def set the_geom=transform(the_geom, 102005);
> >
>
> Table 'def' was created by importing lon/lat data, adding geometry,
> and making points (what you suggested to someone else in another
> thread -- works brilliantly). This table was explicitly set to
> SRID=4326. Hence, the Transform() makes sense here. But, once again,
> should I not also update the geometry_columns entry for this table
> also with the correct SRID (102005) or will the above UPDATE command
> do that for me?
>
> Many thanks,
>
> --
> Puneet Kishor http://punkish.eidesis.org/
> Nelson Inst. for Env. Studies, UW-Madison http://www.ies.wisc.edu/
> Open Source Geospatial Foundation https://edu.osgeo.org/
>


-- 
Puneet Kishor http://punkish.eidesis.org/
Nelson Inst. for Env. Studies, UW-Madison http://www.ies.wisc.edu/
Open Source Geospatial Foundation https://edu.osgeo.org/



More information about the postgis-users mailing list