[Mapserver-users] Unique? Was: mapscript - queryByPoint help, simple Q
Eric Bridger
eric at gomoos.org
Fri Aug 29 02:50:10 PDT 2003
Sorry you're having so much trouble. I do perl mapscript queryByPoint
extensively. Have you tried looking att the GMap PHP demo php source?
It will show you how to do everything with PHP mapscript.
http://www2.dmsolutions.ca/gmap/gmap75.phtml
E.g the following code is wrong:
> $my_point = ms_newpointObj();
> $my_point->setXY($_REQUEST["mapa_x"],$_REQUEST["mapa_y"]
$_REQUEST["mapa_x"] and "mapa_y" are the pixel coordinates of your mouse
click. You need to first transform them to geographic coordinates. The
gmap75.php file contains a function: GMapPix2Geo() which does this.
Here's a perl example:
sub get_click {
my ($q, $map) = @_;
my @current_extent = ();
my($x_map, $y_map) = (0,0);
if($q->param('img.x') && $q->param('imgext')) { # Make sure we got a
click
@current_extent = split(' ', $q->param('imgext'));
my $click_x = $q->param('img.x');
my $click_y = $q->param('img.y');
my $x_pct = ($click_x / $map->{width});
my $y_pct = 1 - ($click_y / $map->{height});
$x_map = $current_extent[0] + ( ($current_extent[2] -
$current_extent[0]) * $x_pct);
$y_map = $current_extent[1] + ( ($current_extent[3] -
$current_extent[1]) * $y_pct);
}
return ($x_map, $y_map);
}
On Fri, 2003-08-29 at 12:08, poff wrote:
> Hello
>
> I know everyone is busy - and thanks a lot for your help.
>
> Only, does _no-one_ use querbypoint with php mapscript?
>
> It's a great feature if I could get it working, and definitely something to
> go in Wiki someday!
>
> Thanks
>
> P
>
More information about the MapServer-users
mailing list