postgis layer: DATA "the_geom from <table> AS foo USING UNIQUE gid"

Steven De Vriendt gisaalter at GMAIL.COM
Mon Nov 19 05:58:55 PST 2007


When I configure my layer as DATA "the_geom from <table_name> AS foo USING
UNIQUE gid"
Mapserver returns the following error:

<ServiceExceptionReport version="1.1.0">
−
    <ServiceException>

msDrawMap(): Image handling error. Failed to draw layer named 'percelen'.
prepare_database(): Query error. Error executing POSTGIS DECLARE (the actual
query) statement: 'DECLARE mycursor BINARY CURSOR FOR SELECT
asbinary(force_collection(force_2d(the_geom)),'NDR'),gid::text from
b_capa_percid AS foo WHERE the_geom && setSRID('BOX3D(76945.5918856108
189996.502536997,91328.1081143621 201805.497460877)'::BOX3D,
find_srid('','b_capa_percid AS foo','the_geom') )'

Postgresql reports the error as 'ERROR:  find_srid() - couldnt find the
corresponding SRID - is the geometry registered in the GEOMETRY_COLUMNS
table?  Is there an uppercase/lowercase missmatch?
'

More Help:

Error with POSTGIS data variable. You specified 'check your .map file'.
Standard ways of specifiying are :
(1) 'geometry_column from geometry_table'
(2) 'geometry_column from (sub query) as foo using unique column name using
SRID=srid#'

Make sure you put in the 'using unique  column name' and 'using SRID=#'
clauses in.

For more help, please see http://postgis.refractions.net/documentation/

Mappostgis.c - version of Jan 23/2004.

</ServiceException>
</ServiceExceptionReport>


However when I add the SRID=31300, Mapserver throws this:


−
    <ServiceExceptionReport version="1.1.0">
−
    <ServiceException>

msDrawMap(): Image handling error. Failed to draw layer named 'percelen'.
msPOSTGISLayerWhichShapes(): Query error. Error executing POSTGIS SQL
statement (in FETCH ALL): DECLARE mycursor BINARY CURSOR FOR SELECT
asbinary(force_collection(force_2d(the_geom)),'NDR'),gid::text from
b_capa_percid AS foo WHERE the_geom && setSRID('BOX3D(76945.5918856108
189996.502536997,91328.1081143621 201805.497460877)'::BOX3D, 31300 )
-ERROR:  Operation on two geometries with different SRIDs


</ServiceException>
</ServiceExceptionReport>


How can I use the gid as unique column ?

Thanks
Steven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20071119/4fcd4b80/attachment.htm>


More information about the MapServer-users mailing list