Select to view content in your preferred language

Zoom to Feature @ Load

745
2
01-19-2011 02:49 PM
JamesLangille
New Contributor
I'd like to set the startExtent to the envelop of a feature that is based on a passed in parameter. I can't figure this out, maybe I'm just not thinking.
0 Kudos
2 Replies
MartenLiebster
Deactivated User
I'd like to set the startExtent to the envelop of a feature that is based on a passed in parameter. I can't figure this out, maybe I'm just not thinking.


Would need to know more about your application's architecture to give a complete answer.

But in my case, to build the extent I'm taking my initial point and then "zooming out" a bit.

var featureExtent = new esri.geometry.Extent(
    {
        "ymin": eval($("#Lat").val()) - 0.0025,
        "xmin": eval($("#Lon").val()) - 0.0025,
        "ymax": eval($("#Lat").val()) + 0.0025,
        "xmax": eval($("#Lon").val()) + 0.0025,
        "spatialReference": { "wkid": 4326 }
    });

myMap = new esri.Map("mapDiv", { extent: featureExtent });


I'm using jQuery and hidden fields, but you could make the extent a parameter and use that.
0 Kudos
HemingZhu
Frequent Contributor
I'd like to set the startExtent to the envelop of a feature that is based on a passed in parameter. I can't figure this out, maybe I'm just not thinking.


map.setExtent(feature.geometry.getExtent().expand(1.5));
0 Kudos