[postgis-users] Re: SRID for USA_Lambert_Conformal_Conic

Dylan Beaudette dylan.beaudette at gmail.com
Sun Aug 20 10:49:14 PDT 2006


On 8/20/06, P Kishor <punkish at eidesis.org> wrote:
> 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.

yes. i have added a custom SRID code for my dataset as well..

> 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.

yes. note that this will need to be updated once you SetSRID() your
geometry for each column that you adjust. I think of this table a
means of 'registering' geometry columns within a single DB.

> 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'
>     )
>   )

-- yes on the SetSRID function, but i would use it something like:
update my_spatial_data set the_geom = SetSRID(the_geom) ;

-- and then, update the geometry_columns table accordingly
update geometry_columns set .....

> 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'
>     )
>   )

concept seems good, but you must always make sure that your
geometry_columns is up-to-date.

looks like you should be on your way!

key concepts:

data always has a coordinate system, but it may not be defined in a
way that PostGIS will understand- hence the SetSRID function. Once the
SRID on your geometry is defined, and registered in the
geometry_columns table, then geometric operations should be possible.


cheers,

Dylan

>
> 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/
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>



More information about the postgis-users mailing list