[Chameleon] search attributes -> zoom to result

Jacob Delfos jacob.delfos at maunsell.com
Tue Oct 26 04:25:12 EDT 2004

Thanks, Paul. It worked beautifully.

At the moment, I create a new instance of a mapobject, having to hardcode the mapfile location. Is there a way to get access to the mapobject of the main application? My search page sits in an Iframe, so it's not really part of it. If I pinch the session ID using javascript, can I use that in php to tap into the mapobject of the main chameleon instance? This would allow me to add some more functionality.



-----Original Message-----
From: Paul Spencer [mailto:pspencer at dmsolutions.ca] 
Sent: 19 October 2004 21:48
To: Jacob Delfos
Cc: chameleon at lists.maptools.org
Subject: Re: [Chameleon] search attributes -> zoom to result


once you know the position in the dbf file, you should be able to open 
the mapfile using php_mapscript and then do something like:

$nlayer = <index of layer in mapfile>;
$nShape = <index of shape>;
$oLayer = $oMap->getLayer( $nLayer );
$oShape = $oLayer->getShape( $nShape );
//bounds is a rectObj
$oRect = $oShape->bounds;
//can compute extents to zoom to from $oRect->minx miny maxx maxy

If you don't want to use the mapfile then you can use mapscript's 
shapefileobj to accomplish the same thing I think



Jacob Delfos wrote:
> Hi all,
> I'm trying to create the functionality of searching a layer for an 
> attribute value, and then zooming to the object (I know there have been 
> many posts about this... sorry... I couldn't actually find a solution).
> I got the searching part figured out; I put an iframe in my template, 
> which holds a page that allows for selecting a layer to search, and then 
> searches for the searchstring in all the attributes of that layer. I'm 
> actually running this independently of the rest of the site (the page 
> does not get submitted for a search, only the iframe is). I store the 
> extent in the attributes, and use javascript to make the mapimage zoom 
> to the extent of the objects(s) it has found. My problem is how to get 
> the real spatial extent of the object. I'm using a basic php script that 
> finds out the name of the dataset, opens its dbf, and searches the 
> attributes. I suppose this is not ideal, since it does not interface 
> with chameleon. It's kind of patchy.
> What is the easiest way to get an object's extent, if I know its 
> sequential position in the dataset? I would prefer not to have to submit 
> the whole page....
> Any tips will be much appreciated.
> Jacob
> Maunsell Australia Pty Ltd
> 629 Newcastle Street
> Leederville WA 6007
> PO Box 81
> Leederville WA 6902
> Western Australia
> ABN 20 093 846 925
> Tel     + 61 8 9281 6185
> Fax    + 61 8 9281 6297
> jacob.delfos at maunsell.com <mailto:jacob.delfos at maunsell.com>
> ------------------------------------------------------------------------
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/chameleon/attachments/20041026/6b325522/attachment.htm

More information about the Chameleon mailing list