function addToMap(featureSet) { //initialize symbology defaultSymbol = new esri.symbol.SimpleMarkerSymbol().setColor(new dojo.Color([255,0,255])); var iconSymbol = new esri.symbol.PictureMarkerSymbol({ "angle":0, "xoffset":0, "yoffset":10, "type":"esriPMS", "url":"http://static.arcgis.com/images/Symbols/Shapes/BluePin1LargeB.png", "contentType":"image/png", "width":24, "height":24 }); var gLayer = new esri.layers.GraphicsLayer(); iTemplate = new esri.InfoTemplate("Sitename", "<tr><td>${Sitename}</tr></td>"); map.addLayer(gLayer); dojo.forEach(featureSet.features,function(feature){ map.graphics.add(feature.setSymbol(defaultSymbol).setInfoTemplate(iTemplate)); //gLayer.add(feature.setSymbol(defaultSymbol).setInfoTemplate(iTemplate)); //var ptX = feature.attributes.centroidLongitude; // returns undefined //var ptX = feature.centroidLongitude; // returns undefined //var ptY = feature.attributes.centroidLatitude; console.log(ptX); gLayer.add(new esri.geometry.Point(ptX,ptY,map.spatialReference).setSymbol(iconSymbol)); });
Solved! Go to Solution.
esri.geometry.geographicToWebMercator(new esri.geometry.Point
var pt = new esri.geometry.Point(ptX,ptY,map.spatialReference);
var pt = new esri.geometry.Point(esri.geometry.geographicToWebMercator(new esri.geometry.Point(ptX,ptY,map.spatialReference)));
esri.geometry.geographicToWebMercator(new esri.geometry.Point
var pt = new esri.geometry.Point(ptX,ptY,map.spatialReference);
var pt = new esri.geometry.Point(esri.geometry.geographicToWebMercator(new esri.geometry.Point(ptX,ptY,map.spatialReference)));