Hi all,
I am trying to zoom to feature when people click on url but I am having some trouble. I am using GlobalID as query item. I am not too sure why it is not picking up the globalID. Any idea?
Thanks,
Alex
map.on("load", initOperationalLayer);
function initOperationalLayer() {
//Get URL as object
roadclosed = getParcelFromUrl(document.location.href);
//Query
var query = new Query();
var queryTaskrc = new QueryTask("http://services.arcgis.com/UHg8l1wC48WQyDSO/arcgis/rest/services/..../FeatureServer/0");
query.where = "GlobalID = '" + roadclosed + "'";
query.returnGeometry = true;
queryTaskrc.execute(query, queryCallbackrc);
}
//Make URL Query
function getParcelFromUrl(url) {
var urlObject = urlUtils.urlToObject(url);
if (urlObject.query && urlObject.query.roadclosed) {
return urlObject.query.roadclosed;
console.log(urlObject.query.roadclosed)
} else {
return null;
}
}
//Query Callback
function queryCallbackrc(featureSet) {
arrayUtil.forEach(featureSet.features, function (feature) {
var thePoint = feature.geometry;
map.centerAndZoom(thePoint, 14);
});
}
Nevermind it seems to work as it should. but i still get weird errors.