[postgis-users] srid of columns in views

Vortex vortex25 at gmx.de
Sat Apr 23 14:19:43 PDT 2005


Hi!

I managed to work with mapserver and geometries in
views which have an srid of -1. But it fails with
real srids:

Warning: [MapServer Error]: msPOSTGISLayerWhichShapes(): Error executing POSTGIS SQL statement (in FETCH ALL): DECLARE mycursor BINARY CURSOR FOR SELECT status::text,speed::text,asbinary(force_collection(force_2d(path)),'NDR'),OID::text from geo_links WHERE path && setSRID('BOX3D(8.07886769806061 48.0274258737248,9.91534773350125 49.2335618636517)'::BOX3D, find_srid('','geo_links','path') ) -ERROR: Operation on two geometries with different SRIDs Error with POSTGIS data variable. You specified ''.

that's not astonishing, since srid() for the "path"
column returns:

 select srid(path) from geo_links limit 1;
 srid 
------
   -1
(1 row)

while find_srid('','geo_links','path') returns the correct value of 4326.
So the && Operator fails.

But i thought i had made the correct entry in postgis.geometry_columns for the geo_links view:

  f_table_catalog | f_table_schema |   f_table_name    | f_geometry_column | coord_dimension | srid |      type       
-----------------+----------------+-------------------+-------------------+-----------------+------+-----------------
                 | public         | geo_links         | path              |               2 | 4326 | LINE
                 | public         | geo_stations      | position          |               2 | 4326 | POINT
                 | geodata        | countryboundaries | the_geom          |               2 | 4269 | MULTIPOLYGON
                 | geodata        | majorcities       | the_geom          |               2 | 4269 | POINT

and for real tables it seems to work:

eclaim=# select srid(the_geom) from geodata.railroads_l limit 1;
 srid 
------
 4326
(1 row)

But i must confess that i still don't get this srid stuff very well.
It seems that there are "geometries" which are including srid settings
and others who don't. I suppose the srid information isn't stored in
every dataset but instead in the table definition by geometry_columns?
And than it is re-applied when i get the data out of the table?
But is it part of the geometry itself or does the srid() function
look at geometry_columns too? I suppose only find_srid() looks at
the geometry_columns table while srid() gets the information directly
from the geometry? But why is it different in my example?
Or am i completely wrong?

Thank you very much!

Klaus

-- 
======================================================
" WWW:   http://db0fhn.efi.fh-nuernberg.de/~dg1nav?em
" LOCAL: klaus at castle.kwsnet
" EMAIL: klauXweg at gmx.de (remove "X"!)
" AX.25: dg1nav at db0fhn.#bay.deu.eu



More information about the postgis-users mailing list