for (var i=0, il=resultFeatures.length; i<il; i++) { var point_x = resultFeatures.attributes.x; var point_y = resultFeatures.attributes.y; var point_wkid = resultFeatures.geometry.spatialReference.wkid; //console.log(point_x +" "+ point_y +" "+ point_wkid); var pointGraphic = new esri.Graphic(new esri.geometry.Point(point_x, point_y, new esri.SpatialReference({ wkid: point_wkid }) ), hmg.markers[4]); pointGraphic.setInfoTemplate(infoTemplate); map.graphics.add(pointGraphic); }
Sorry for the slight delay in replying. That's really useful.Having seen what you have said about being able to use custom icons with the QueryTask, I thought I'd see if I could get it working - using the code that worked from the esri.request code.I get markers on the map, but they appear at 0,0 lat/long which is odd, and I'm not entirely sure why - I assume it's something to do with the wkid, but the code I'm using below seems correct - but obviously isn't!If I output the x/y/wikd I get: x - 456309, y - 520207 wkid - 3857 and these come from the layer. My base map is Bing, but I don't see how that would be a problem.Is there something obvious that I'm doing wrong which is making them appear at 0,0?Thanks. for (var i=0, il=resultFeatures.length; i<il; i++) { var point_x = resultFeatures.attributes.x; var point_y = resultFeatures.attributes.y; var point_wkid = resultFeatures.geometry.spatialReference.wkid; //console.log(point_x +" "+ point_y +" "+ point_wkid); var pointGraphic = new esri.Graphic(new esri.geometry.Point(point_x, point_y, new esri.SpatialReference({ wkid: point_wkid }) ), hmg.markers[4]); pointGraphic.setInfoTemplate(infoTemplate); map.graphics.add(pointGraphic); }
var requestHandle = esri.request({ url: url.path, //url is a variable for the whole querystring +&f=json content: url.query, //handleAs: "text", load: requestSucceeded, error: requestFailed }, {useProxy:true});
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.