[Chameleon] search attributes -> zoom to result
Paul Spencer
pspencer at dmsolutions.ca
Tue Oct 19 09:47:43 EDT 2004
Jacob,
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 );
$oLayer->open();
$oShape = $oLayer->getShape( $nShape );
//bounds is a rectObj
$oRect = $oShape->bounds;
//can compute extents to zoom to from $oRect->minx miny maxx maxy
$oShape->free();
$oLayer->close();
If you don't want to use the mapfile then you can use mapscript's
shapefileobj to accomplish the same thing I think
Cheers,
Paul
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
>
>
> JACOB DELFOS
> SPATIAL INFORMATION ANALYST
> 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
More information about the Chameleon
mailing list