Possible bug?
Sergio López
sergiodlopez at YAHOO.COM
Thu May 18 11:48:16 PDT 2006
Hello, I need help because I have bumped into a weird issue while migrating from Mapserver 4.6 to 4.8.
I have several applications running perfectly well based on MS4W 1.3.0. They´re developed in PHPMapscript and I use shapefile and POSTGIS data.
When I migrated to mapserver 4.8 (in MS4W 1.5.0), This error appears when I tried to query POSTGIS point layers (only postgis, not shapefiles):
----------------------------------------------------------------------------------------
Warning: [MapServer Error]: prepare_database(): 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 ejidos WHERE the_geom && setSRID('BOX3D(5676966.1875 6041297.8425,5800095.4875 6139801.2825)'::BOX3D, find_srid('','ejidos','the_geom') )'
Postgresql reports the error as 'ERROR: cursor "mycursor" already exists '
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. in /opt/fgs/www/htdocs/BA2ss/index.php on line 115
Fatal error: Call to a member function on a non-object in /opt/fgs/www/htdocs/BA2ss/index.php on line 116
----------------------------------------------------------------------------------------
Analyzing the problem I found out that error occurs when I query a point layer which has other layers below in the map file. For example if I have a cities layers over a state layer error occurs, but if I turn off the polygon layer don´t. I have to remark that this only happens with POINT layers.
I have to say that until mapserver 4.6 all worked perfectly!. By the way, I tried the code in a XP box and in a SUSE 10 one, and the same happens. I´m also using POSTGRESQL 8.1 with POSTGIS 1.1
The code I use to make the point queries is:
----------------------------------------------------------------------------------------
$pun_cons = ms_newpointobj();
$pun_cons->setxy($geo_x, $geo_y);
$layerbyname = layer_seleccionado($_GET['obj_layer1']);
$capa_activa = $mapa->getLayerbyname($layerbyname); //layerObj getLayer(int index)
//$nombre_layer= $capa_activa->name; //nombre del layer activo consultado
//$resul_cons = @$capa_activa->queryByPoint($pun_cons, MS_SINGLE, -1);
if(@$capa_activa->queryByPoint($pun_cons, MS_SINGLE,$tolerancia) == MS_FAILURE) {
//return array("NO SE INTERSECTO RASGO!",$nombre_layer);//$resul_cons;//
$vacio = "<br><table ALIGN = 'center' border='1' bgcolor='#99FF66'><tr><td>Consulta Vacia</td></tr></table>";
return $vacio;
exit;
}else if ($capa_activa->status == MS_ON){
$resultados = $capa_activa->getresult(0); //Returns a resultCacheMemberObj by index from a layer object withindex in the range 0 to numresults-1.
//Returns a valid object or FALSE(0) if index is invalid.
$shape_index = $resultados->shapeindex; // Instances of ResultCacheMemberObj are always obtained through
//layerObj's getResult() method.
$tile_index = $resultados->tileindex;
if($capa_activa->open() == MS_FAILURE) {
return "No se pudo abrir ".$resultados->name;
exit;
}
// 
$shape = $capa_activa->getshape($tileindex, $shape_index);
$capa_activa->close;
----------------------------------------------------------------------------------------
Please help me if you can´t because I analized the code and as far as I know seems right to me.
Thanks in advance
Sergio
Argentina
---------------------------------
Yahoo! Autos. Más de 100 vehículos vendidos por día.
¿Qué esperás para vender el tuyo?
Hacelo ahora y ganate un premio de Yahoo!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20060518/acdd9286/attachment.htm>
More information about the MapServer-users
mailing list