[Mapserver-users] zoom-to-feature precision varies?

Dylan Keon keon at nacse.org
Fri Jul 30 11:08:27 PDT 2004


I'm working on an app that allows the user to zoom to a feature after 
querying the map.  I grab the $shapeObj->bounds of the feature (UTM 
coords), calculate the center of the bounding box, and use zoomScale() 
to zoom centered on that feature.

It works great when the map is already zoomed in to a relatively small 
extent - it zooms in a bit further and centers perfectly on the feature. 
  However, when starting from the full map extent, it's hit and miss. 
After zooming in all the way, the feature will usually appear somewhere 
on the map view, it just won't be centered.  If you then click that 
feature's button again on the resulting page, it will center perfectly.

It looks like it's not precise enough when zooming from a large extent 
to a small extent, but zooming a small amount works great when trying to 
center on a point.  Has anyone else noticed this?  Or is it more likely 
my code?  I found the same behavior when using zoomRectangle().

If it helps, take a look at http://gis.nacse.org/temp/demo/index.php

Thanks,
--Dylan



More information about the MapServer-users mailing list