[Geomoose-users] Zoom To Selected
Jeffrey Schmitz
jeffreykschmitz at gmail.com
Tue Jan 18 19:46:32 EST 2011
A rather late response, but this should be helpful on this topic. I reworked
the query php so that geomoose will zoom to a bounding box of all of the
search results of a query. In your query.php file replace the
for($rx = 0; $rx < $numResults; $rx++) {
}
loop with:
for($rx = 0; $rx < $numResults; $rx++) {
$res = $queryLayer->getResult($rx);
$aRes = $queryLayer->getFeature($res->shapeindex);
$abounds = $aRes->bounds;
if($rx == 0){
$theMinX = $abounds->minx;
$theMaxX = $abounds->maxx;
$theMinY = $abounds->miny;
$theMaxY = $abounds->maxy;
}
if($theMinX > $abounds->minx){
$theMinX = $abounds->minx;
}
if($theMaxX < $abounds->maxx){
$theMaxX = $abounds->maxx;
}
if($theMinY > $abounds->miny){
$theMinY = $abounds->miny;
}
if($theMaxY < $abounds->maxy){
$theMaxY = $abounds->maxy;
}
array_push($resultFeatures, $aRes);
}
then replace
if(($totalResults == 1 and $firstResult != false) or ($totalResults >= 1 and
$zoomToFirst == true)) {
$bounds = $firstResult->bounds;
printf('GeoMOOSE.zoomToExtent(%f,%f,%f,%f);', $bounds->minx,
$bounds->miny, $bounds->maxx, $bounds->maxy);
}
with
if($totalResults > 0){
printf('GeoMOOSE.zoomToExtent(%f,%f,%f,%f);', $theMinX, $theMinY,
$theMaxX, $theMaxY);
}
Finally, place these lines
$theMinX = null;
$theMaxX = null;
$theMinY = null;
$theMaxY = null;
just above the line
for($la = 0; $la < sizeof($query_layers); $la++) {
This should allow the zoom to be adjusted to the maximum bounds of your
search results. Best of luck! Feel free to ask any questions.
-Jeff
On Thu, Sep 9, 2010 at 3:38 PM, Bill Harbour <bharbour at bcbe.org> wrote:
> Is there an equivalent to ESRI’s zoom to selected??? I’m using a query
> service to find subdivision(s). All the parcels in the sub get
> highlighted. If I do a search that contains parts of a sub name…say the
> first letters in multiple phases, then all of those subs are hightlighted.
> Is there a way to tell the query service to zoom to the extent of the
> selected features??
>
>
>
> Thanks,
>
>
>
> Baldwin County Public Schools
>
> Bill Harbour
>
> GIS Coordinator
>
> Information Technology Services
>
> Baldwin County Board of Education
>
> 1071* * B Ave
>
> Loxley, AL 36551
>
> V 251-580-1916
>
> F 251-972-6851
>
> Office 251-972-6850
>
> bharbour at bcbe.org
>
> http://www.bcbe.org
>
> *"When life gets too unreal, sit down with a good book."* - Garrison
> Keillor
>
>
>
>
> ------------------------------------------------------------------------------
> This SF.net Dev2Dev email is sponsored by:
>
> Show off your parallel programming skills.
> Enter the Intel(R) Threading Challenge 2010.
> http://p.sf.net/sfu/intel-thread-sfd
> _______________________________________________
> Geomoose-users mailing list
> Geomoose-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geomoose-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/geomoose-users/attachments/20110118/0ea21368/attachment.html
More information about the Geomoose-users
mailing list