[mapserver-users] Projection and mapquery

Morten Sickel Morten.Sickel at nrpa.no
Thu Jan 28 10:37:21 PST 2010


I presently have a set up in which I plot some measurements on some background maps. Things work fine, but I want to add the possibility to query the measurement data set by clicking on a measurement. The measurements have coordinates in lat lon and I only manage to query those data if I plot the entire map in the same projection. I have tried to reproject the query point using code like

$mapproj=$map->getProjection();
$layerproj=$map->getlayerbyname('mobil')->getProjection();
if($mapproj!=$layerproj){
	$mapproj=ms_newProjectionObj($mapproj);
	$layerproj=ms_newProjectionObj($layerproj);
	debug(array($geopoint->x,$geopoint->y));
	$geopoint->project($mapproj, $layerproj); 
	// projects the point from the projection of the map to the projection of layer
	debug(array($geopoint->x,$geopoint->y));	
} 

 the debug function just dumps the data and it is clear that the point is correctly reprojected, but anyhow 
$map->queryByPoint($geopoint, MS_MULTIPLE, 1); 
never gives anything if the mobil-layer and the map are in different projections. 

Are there any ways to overcome this? As I am mostly working on maps from 60 deg north and upwards, geographical projection is not the projection of choise and I would prefer not having to reproject the measurement data.

M.


More information about the MapServer-users mailing list