I am currently trying to draw a point with the ArcGIS Javascript API.
Pretty much like this example, http://help.arcgis.com/en/webapi/javascript/arcgis/demos/toolbar/toolbar_draw.html, except the point will not be drawn with the mouse, but from an javascript object.
If we look at the code, we see that a geometry object/array is passed in the function.
function addToMap(geometry) {
toolbar.deactivate();
map.showZoomSlider();
var symbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 10, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,0,0]), 1), new dojo.Color([0,255,0,0.25]));
var graphic = new esri.Graphic(geometry, symbol);
map.graphics.add(graphic);
}
If someone could write the structure for that object, and a method to draw the point (such as a button, with an onclick event, containing fixed xy coords)
Dumping geometry
looks like this http://pastebin.com/P9wfL36b (ouch!)
This code will be used in a GPS tracking experiement, where I'll pull the current position from a database every 20 seconds or so. (details will not be covered in this post)
Bonus question: How do I convert long/lat to xy coords from the sample?
I use UTM zone 29N, wkid: 32629