Solved! Go to Solution.
I have spent 2 days on what i think is something simple. My Query is not working in the onclick function and i think it has something to do with my extents being defined wrong, but i'm not sure - i have checked the forums and have not seen similar issues. I was hoping one of you might see something simple in the attached file:
Here is my extent definition:
var startExtent = new esri.geometry.Extent({"xmin":-74.487856,"ymin":40.849173,"xmax":-73.487856,"ymax":40.649173,"spatialReference":{"wkid":2263}});
Here is the onclick block - feature,length always comes back as 0.
dojo.connect(map, "onClick", function(evt) {
selectQuery.geometry = evt.mapPoint;
waterHydrantsFL.selectFeatures(selectQuery, esri.layers.FeatureLayer.SELECTION_NEW, function(features) {
if (features.length > 0) {
//store the current feature
updateFeature = features[0];
map.infoWindow.setTitle(features[0].getLayer().name);
map.infoWindow.show(evt.screenPoint,map.getInfoWindowAnchor(evt.screenPoint));
} else {
map.infoWindow.hide();
}
});
});
thanks
I'm not able to get your your REST endpoints, are they supposed to be public?
I put some code on jsfiddle a while back showing how to build a small extent from a point and do a selection: http://jsfiddle.net/swingley/Bkswj/ And talked a bit about it here: http://forums.arcgis.com/threads/36210-popup-widget-for-ArcGISDynamicMapServiceLayer?p=147007&viewfu...
For your extent, it looks like you're specifying lat, long values but your spatial reference specifies a projected coordinate system (Long Island State Plane). Use the SRID for WGS84 in your extent, which is 4326.