[postgis-users] srid

Chris Hermansen chris.hermansen at timberline.ca
Mon May 26 11:47:10 PDT 2008


Bob, maybe it's just me, but your questions about srid seem to be
exploring a strange part of that structure.

For example, I have a student project database here called "project1"
(nice name, eh?).  It contains a bunch of geographic tables; for
example, the table "sitios".

"sitios" looks like this:

                                     Table "public.sitios"
       Column   |       Type        |                     
    Modifiers                      
    ------------+-------------------+------------------------------------------------------
     gid        | integer           | not null default
    nextval('sitios_gid_seq'::regclass)
     codigo     | character varying |
     sector     | character varying |
     nombreluga | character varying |
     funcion    | character varying |
     comentario | character varying |
     the_geom   | geometry          |
    Indexes:
        "sitios_pkey" PRIMARY KEY, btree (gid)
        "sitios_geo_idx" gist (the_geom)
        "sitios_idx" btree (gid)
    Check constraints:
        "enforce_dims_the_geom" CHECK (ndims(the_geom) = 2)
        "enforce_geotype_the_geom" CHECK (geometrytype(the_geom) =
    'POINT'::text OR the_geom IS NULL)
        "enforce_srid_the_geom" CHECK (srid(the_geom) = 24879)


Note that the geometry is in a column called "the_geom".

If I look in the table "geometry_columns", I see the following row
corresponding to "sitios":

    project1=# select * from geometry_columns where f_table_name = 'sitios';
     f_table_catalog | f_table_schema | f_table_name | f_geometry_column
    | coord_dimension | srid  | type 
    -----------------+----------------+--------------+-------------------+-----------------+-------+-------
                     | public         | sitios       | the_geom         
    |               2 | 24879 | POINT


See the attribute "srid" in table "geometry_columns"?  For table
"sitios", it's set to 24879.  I can find this srid in the table
"spatial_ref_sys" as follows:

    project1=# select * from spatial_ref_sys where auth_srid = 24879;
     srid  | auth_name | auth_srid
    |                                                                                                                                                                                                                                                                                                     
    srtext                                                                                                                                                                                                                                                                                                      
    |                        proj4text                        
    -------+-----------+-----------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------
     24879 | EPSG      |     24879 | PROJCS["PSAD56 / UTM zone
    19S",GEOGCS["PSAD56",DATUM["Provisional_South_American_Datum_1956",SPHEROID["International
    1924",6378388,297,AUTHORITY["EPSG","7022"]],AUTHORITY["EPSG","6248"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4248"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-69],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",10000000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","24879"]]
    | +proj=utm +zone=19 +south +ellps=intl +units=m +no_defs
    (1 row)

OK, so now I see that the geometry in table "sitios" is "point" (from
"geometry_columns") and in srid 24879 which is PSAD56 - provisional
south american datum 56 (from "spatial_ref_sys").

Lastly, if I look at the geometry itself in "sitios":

    project1=# select asText(the_geom) from sitios;
                      astext                 
    ------------------------------------------
     POINT(741614.062489468 5628072.4999648)
     POINT(674306.187446182 5704431.49999243)
     POINT(719626.3749895 5828010.50002511)
     POINT(721600.874965506 5816697.50005473)
     POINT(707558.874971081 5819902.50002712)

Now it seems that PostGIS "supports" embedded srids in the geometry, so
you can also do the following:

    project1=# select asEWKT(the_geom) from sitios;
                           asewkt                       
    -----------------------------------------------------
     SRID=24879;POINT(741614.062489468 5628072.4999648)
     SRID=24879;POINT(674306.187446182 5704431.49999243)
     SRID=24879;POINT(719626.3749895 5828010.50002511)
     SRID=24879;POINT(721600.874965506 5816697.50005473)
     SRID=24879;POINT(707558.874971081 5819902.50002712)

In theory, I guess, this means you could have a separate / distinct SRID
for each row of geometry, though I have to say I've never tried.

But it sounds to me as though you want to have a different SRID for each
row of your geometry, which doesn't sound like "the right thing to do"
to me.

OK, if you're still reading, does the above ring any bells for you?  If
not, explain to us what exactly you're trying to do with your use of
st_transform() and maybe we can make some suggestions.

Bob Pawley wrote:
> I think I have the spatial_ref_table with a couple of rows that should
> be recognized by the ST_Transform function.
>
> However, I now get the error "Input geometry has unknown (-1) srid".
>
> Does anyone have a thought on how to overcome this? Is this error
> realing telling me that the function still doesn't recognize the srid?
>
> Bob
>
>
>
>
> ----- Original Message ----- From: "Andy Anderson"
> <aanderson at amherst.edu>
> To: "PostGIS Users Discussion" <postgis-users at postgis.refractions.net>
> Sent: Sunday, May 25, 2008 11:20 AM
> Subject: Re: [postgis-users] srid
>
>
>> SRID is an index into the table of datums/projections/coordinate 
>> systems that PostGIS maintains; the commands to create that table
>> are  in the file spatial_ref_sys.sql that comes with the distribution.
>>
>> If you want to build your own transformation, you could start with
>> one  of the listed INSERT statements that matches the type of
>> projection,  and change the coordinates to match your interest. Then
>> add it to the existing table with an SRID that isn't being used.
>>
>> By the way, the SRID is part of the EPSG standard
>> <http://en.wikipedia.org/wiki/SRID
>> >, so keep that in mind for future potential conflicts.
>>
>> -- Andy
>>
>> On May 25, 2008, at 12:21 PM, Bob Pawley wrote:
>>
>>> Hi
>>>
>>> I am attempting to learn Postgis to use as a geometric tool rather 
>>> than a geographic tool.
>>>
>>> The function ST_Transform(geometry, integer)  seems to be 
>>> potentially quite useful.
>>>
>>> Apparently, the integer required is the new coordinates referenced 
>>> by the srid. Is there some way of building a spatail reference
>>> table  in which I can enter my coordinates that the ST_Transform
>>> function  will recognize. My first simplistic attempt (entering a
>>> coordinate  with an id) didn't work.
>>>
>>> Bob
>>> _______________________________________________
>>> 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 
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users


-- 
Regards,

Chris Hermansen         mailto:chris.hermansen at timberline.ca
tel+1.604.714.2878 · fax+1.604.733.0631 · mob+1.778.232.0644
Timberline Natural Resource Group · http://www.timberline.ca
401 · 958 West 8th Avenue  · Vancouver BC · Canada · V5Z 1E5




More information about the postgis-users mailing list