[Mapserver-users] PHP/MapScript question: How to return values when map is clicked?

Krung Saengpole krung at cad.go.th
Thu Sep 11 17:58:51 EDT 2003


use queryByPoint(...). But you have to convert point in image to georef and make a pointObj from it.  e.g.

$point=ms_newPointObj();
$point->setXY(x_coordinate, y_coordinate);

if (@$layer->queryByPoint($point,MS_SINGLE,0) == MS_SUCCESS) {
	$result = $layer->getResult(0);
	$index = $result->shapeindex+1;
	$dbf = dbase_open(DBF_FILE,0);
	$arr = dbase_get_record($dbf,$index);
......

HTH
Krung

---------- Original Message ----------------------------------
From: har mar <shaz_bot42 at yahoo.com>
Date:  Thu, 11 Sep 2003 13:05:26 -0700 (PDT)

>Hello,
> 
>I am displaying a shapefile that contains states as a GIF.  I am not using javascript at all.  When the user clicks on the map, I want to return the name of the state that was clicked, and some other information that is in the dbf file.  How do I do this?  I can get the x,y coords by having the GIF set as an input type. I assume I will have to convert them to georef coords.  But I am unsure of what 'function' to use to get those results.  Any help would be greatly appreciated. 
> 
>Cheers
> 
>
>
>---------------------------------
>Do you Yahoo!?
>Yahoo! SiteBuilder - Free, easy-to-use web site design software
>_______________________________________________
>Mapserver-users mailing list
>Mapserver-users at lists.gis.umn.edu
>http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>
>
>




More information about the mapserver-users mailing list