Hello, I've got a pesky problem I'm trying to figure out.
I've got a dual webpage arrangement. Both have web maps on them. The map on the 2nd page (a child of the first) will be a zoomed-in map of the feature selected by the user (via clicking) on the first (parent) page and map.
In the first page I've got a handler for the click event. The code is like this, standard stuff: The user clicks on a parcel on a Feature layer which fires the handler:
return dojo.map(response, function (result)
{
var feature = result.feature;
feature.attributes.layerName = result.layerName;
if (result.layerName === 'Parcels')
{
feature.setInfoTemplate(ParcelTemplate);
}
return feature;
}
The above is in an executeIdentifyTask function. What I want to do is extract the xmin, xmax, ymin and ymax attributes from the selected feature and store them each in a separate variable. That way I can pass them into the URL of the 2nd web page and use them to set the extent of the map in the 2nd page. I know how to do that, I just can't figure out how to extract the xmin, xmax, etc from the selected feature.
I've looked at the specs of the Feature layer and Geometry classes but it's not clear to me how they're arranged. I'm thinking something like (before "return feature"):
xmin=feature.Extent.xmin;
or
xmin=feature.Geometry.xmin
After declaring "var xmin" at the top of the script. But all the different combinations I've tried either crash the page or give me an "undefined" result.
Assistance would be appreciated.
Solved! Go to Solution.
John,
It would be more like:
xmin = feature.geometry.getExtent().xmin
It worked! Thanks!!!
John,
Glad to help. Don't forget to mark this thread as answered. To do this you have to open the thread (you can not see the correct answer link from inside your inbox) and then you will see the green star with correct answer link. Just click that link on the thread that answered your question.