function addLocation(lon,lat,desc,date,address,field1){ //create a point form the input lat/long var point = new esri.geometry.Point(lon,lat, new esri.SpatialReference(4326)); //associate the info with the graphics as attributes var attributes = { 'Address':address, 'Field1': field1, 'Description':desc }; //define an info template so a popup window with the point details appears when you click point var infoTemplate = new esri.InfoTemplate('${Field1}','${*}'); //define a symbol and add point to map var locationSymbol = 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 }); //convert the point from geographics coords to web mercator since map is in web mercator var webMercatorGeometry = esri.geometry.geographicToWebMercator(point); var graphic = new esri.Graphic(webMercatorGeometry,locationSymbol,attributes,infoTemplate); map.graphics.add(graphic); map.centerAndZoom(webMercatorGeometry,12); }
Solved! Go to Solution.