[maplab-users] Zoom To Feature

Swapan Mazumdar swapan at dataworld.co.za
Wed Jun 9 03:59:06 EDT 2004

Hi Zak,


Thank you very much for your help. To be honest I had nightmare with
chameleon trying to setup and go on with understanding widgets. Somehow
I had some visibility problems with MapServer CGI variables. Thankfully
I am on with MapLabs tweaking spree. I have made two progress as of now.
One I am now able to call PHP MapScript Objects and Methods from php
page. And I am able to trap the flow of execution of the published map
application created by GMapFactory. 
If I could call the required method from PhpMapScript to Zoom to Item or
Feature, then I would be able to accomplish my objective.

Currently, I can query on layer and find by index position using code
snippet written below. The code doesn't zoom to the feature. How can I
implement ITEMQUERY feature? 
Regarding my problem with accessing 
GetMap directly from the IE browser I am getting some ascii file
downloaded I consider it as junk because when I specify any Image Viewer
to open it just fails. What is wrong with my MapServer setting. I am
running on windows/IIS.

I would appreciate your help in this regard.

$map = ms_newMapObj($map_path."saxplorer.map");
$layerObj = $map->getLayerByName("municipality");
$shapeObj = $layerObj->getShape(-1, 10);
$st = $layerObj->queryByShape($shapeObj);
if($st == MS_SUCCESS){
	$shapefound = $map->queryByIndex(1, -1, 10, MS_FALSE);
	$imageObj = $map->drawQuery();
	echo $shapefound."FOUND";
echo "<BR>".$image_url;
echo "<BR>".$image_url1;

-----Original Message-----
From: Zak James [mailto:zak-ms at hoppsan.org] 
Sent: 03 June 2004 05:23 PM
To: Swapan Mazumdar
Cc: maplab-users at lists.maptools.org
Subject: Re: [maplab-users] Zoom To Feature

On Jun 3, 2004, at 7:36 AM, Swapan Mazumdar wrote:

> 1) How can I implement zoom to an Item(Feature) in MapLab. Please
> to the demo shown in case 1 on
> http://maps.dnr.state.mn.us/mapserver_demos/tests36/itemquery/ 
> test.html.
> Actually I would have like to zoom to polygon(province) from a
> list.

You would have to edit the php code generated by gmapfactory to do  
this. It's not really a good solution as gmapfactory was never intended

to generate extendable applications. The ideal solution for this  
problem is the chameleon package (see http://www.maptools.org) which  
already has a 'widget' for zooming to pre-defined map extents. You  
could take the sample chameleon application and modify it for your  
purposes. The chameleon application's template is just an html document

with extra tags so it is relatively straightforward to edit.

> 2) Is it possible to provide an option of active layer in the
> mapping application?

Again, you would have to write your own code and chameleon already has  
similar functionality in some of its widgets (the locate widget, for  

> 3) All my .map files work fine with MapLab. But why I am not able to
> Test With A GetMap Request using
>     http://localhost/cgi-bin/mapserv?map=
> tutorial.map&VERSION=1.1.0&REQUEST=GetMap
>     Just like what is it is explained in
> http://localhost/msapps/maplab-2.1-rc3/htdocs/mapedit/docs/wms-server-

> ho
> wto.html

Make sure that your wms layer has all the required metadata. What error

message do you get?

Zak James
Applications and Software Development
DM Solutions Group Inc.

More information about the Maplab-users mailing list