[Mapserver-users] Map files CGI - PHP MapScript

Benjamin Wragg bwragg at mappingandbeyond.com
Mon Dec 2 18:14:26 PST 2002


This is a multi-part message in MIME format.

------=_NextPart_000_0003_01C29AC9.B7AE9090
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Hi guys,
 
I just have a question regarding how Map files work in both CGI and PHP
MapScript environments?
 
In a CGI environment say I go to my MapServer html pages and fire up the
default page e.g index.html. Is it correct in saying that doing this
request gets sent to mapserv.exe containing, among other things, the
path to a map file e.g demo.map? MapServer now parses the Map file,
loads the data specified and creates an image in the IMAGEPATH directory
which is specified in the map file?
 
Say I now zoomed in on the map, another request is sent to the
mapserv.exe except this time the minx, miny, maxx, maxy are specified.
Because of its stateless nature does MapServer have to parse the map
file again reloaded all the data and restore any database connections?
 
Regarding a PHP MapScript environment (which I'm still coming up to
speed with, so please excuse me if I don't use the correct terms) when
the default page is fired up a few lines like the following tell
MapServer to parse the europe.map file and create an image:
 
$map_path="/var/www/html/ms/map_files/";    
$map = ms_newMapObj($map_path."europe.map");
$image=$map->draw();
$image_url=$image->saveWebImage(MS_PNG,1,1,0);
 
If I now zoom in on the map, is it possible to reuse the $map object
used in the above lines of code, or do I need to recreate the object
again, resulting in the parsing of the map file again and reloading and
restoring of the data connections?
 
Thanks,
 
Benjamin Wragg

------=_NextPart_000_0003_01C29AC9.B7AE9090
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<TITLE>Message</TITLE>

<META content=3D"MSHTML 5.00.3504.2500" name=3DGENERATOR></HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D209000122-02122002>Hi=20
guys,</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D209000122-02122002></SPAN></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D209000122-02122002>I just =
have a=20
question regarding how Map files work in both CGI and PHP MapScript=20
environments?</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D209000122-02122002></SPAN></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D209000122-02122002>In a =
CGI environment=20
say I go to my MapServer html pages and fire up the default page =
e.g=20
index.html. Is it correct in saying that doing this request gets sent to =

mapserv.exe containing, among other things, the path to a map file =
e.g=20
demo.map? MapServer now parses the Map file, loads the =
data=20
specified and creates an image in the IMAGEPATH directory which is =
specified in=20
the map file?</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D209000122-02122002></SPAN></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D209000122-02122002>Say I =
now zoomed in=20
on the map, another request is sent to the mapserv.exe except =
this=20
time the minx, miny, maxx, maxy are specified. Because of its =
stateless=20
nature does MapServer have to parse the map file again reloaded all the =
data and=20
restore any database connections?</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D209000122-02122002></SPAN></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><SPAN =
class=3D209000122-02122002>Regarding a PHP=20
MapScript environment (which I'm still coming up to speed with, so =
please excuse=20
me if I don't use the correct terms) when the default page is fired =
up a=20
few lines like the following tell MapServer to parse the europe.map file =
and=20
create an image:</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D209000122-02122002></SPAN></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D209000122-02122002>$map_path=3D"/var/www/html/ms/map_files/";&nbs=
p;   <BR>=20
$map =3D=20
ms_newMapObj($map_path."europe.map");<BR>$image=3D$map->draw();<BR>$im=
age_url=3D$image->saveWebImage(MS_PNG,1,1,0);</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D209000122-02122002></SPAN></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D209000122-02122002>If I =
now zoom in on=20
the map, is it possible to reuse the $map object used in the above lines =
of=20
code, or do I need to recreate the object again, resulting in the =
parsing of the=20
map file again and reloading and restoring of the data=20
connections?</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D209000122-02122002></SPAN></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D209000122-02122002>Thanks,</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D209000122-02122002></SPAN></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><SPAN =
class=3D209000122-02122002>Benjamin=20
Wragg</SPAN></FONT></DIV></BODY></HTML>

------=_NextPart_000_0003_01C29AC9.B7AE9090--




More information about the MapServer-users mailing list