[mapserver-users] Setting a map extent for point data (phpmapscript)

E Perik erwin at perik.nu
Tue Jun 11 11:39:52 PDT 2002


Hoi Bart,

Maybe too obvious, but is there a space between $ and distance in your
original script? In your mail there is a space,...:
$minx = ( [XCOORD] ) - $ distance;

>From the top of my head you have to 'get' your cgi-value into
php-environment.

Try the following (not tested):

global $XCOORD;
global $YCOORD;
$distance = 1000;
$minx $XCOORD - $distance;
$miny = $YCOORD - $distance;
$maxx = $XCOORD + $distance;
$maxy = $YCOORD + $distance;
$map->SetExtent( $minx, $miny, $maxx, $maxy );

Cheers,

Erwin


-----Original Message-----
From: owner-mapserver-users at lists.gis.umn.edu
[mailto:owner-mapserver-users at lists.gis.umn.edu] On Behalf Of Bart van
Heijningen
Sent: dinsdag 11 juni 2002 0:50
To: Mapserver-Users
Subject: [mapserver-users] Setting a map extent for point data
(phpmapscript)

Hi List,
I have a zip code point dataset on which I would like to perform a text
search via a form.
The search works out fine but I just cannot seem to be able to give the
projected map a good map_extent (see snippett).
Believe me I tried quite some options but you can probably tell me the
one I missed out on.

I tried to do the following to have say 1000 x 1000 meter extend around
the location of the zip point.
 
<?

$distance = 1000;                 // <--change this 
$minx = ( [XCOORD] ) - $ distance;
$miny = ( [YCOORD] ) - $ distance;
$maxx = ( [XCOORD] ) + $ distance;
$maxy = ( [YCOORD] ) + $ distance;
$map->SetExtent( $minx, $miny, $maxx, $maxy );

?>
 
sure  the php is not touched when passed through the cgi.. But now I
wonder how I could perform calculations like these..

Another option I tried:


<img
src="/cgi-bin/mapserv?map=[map]&item=zip&value=[value2]&mode=itemqueryma
p&mapext=shapes&map_extent=shapes" height="300" width="300"></td>

or

<td><img
src="/cgi-bin/atms?map=[map]&item=Pc6nr&value=[value]&mode=itemquerymap&
mapext=[mapext]" height="300" width="300"></td>

The bottom line I did not succeed in dynamically adjusting the
mapextent. Sorry..
Help would be really appreciated.

Thanx,
Bart

(I am still working with the (old) MS 3.5 and RH7.0 php3.x, as I got
really frustrated in trying to make 3.6 and php4.x & RH7.3 to be friends
and never got an answer how to get it to work. The only comfort being
that I am apparently not the only one out there.)






More information about the MapServer-users mailing list