Adding a point from a button click can be as simple as:
dojo.connect(dojo.byId('pointButton'), 'onclick', function() {
map.graphics.add(new esri.Graphic(
// Point coordinates are 0, 0
new esri.geometry.Point(0, 0, map.spatialReference),
new esri.symbol.SimpleMarkerSymbol()
));
});
And the pointButton node is:
<button id="pointButton">Click to add a point.</button>
To add a point when the map is clicked is pretty straightforward as well:
dojo.connect(map, 'onClick', function(evt) {
map.graphics.add(new esri.Graphic(
evt.mapPoint,
new esri.symbol.SimpleMarkerSymbol()
));
});
Live example showing both here: http://jsfiddle.net/swingley/auyHf/
Regarding converting from lat, long to another coordinate system: if you're converting to or from lat, long to web mercator, there are client side methods available to do this: esri.geometry.geographicToWebMercator and esri.geometry.WebMercatorToGeographic. If you need to convert from lat, long to something other than web mercator, then the geometry service's project method is the way to go.
Change the value you're passing for basemap
in the BasemapToggle
constructor from:
basemap: 'Local',
to:
basemap: 'local'
(i.e. a lowercase 'L'). Then it'll render right off the bat. I think the value has to match exactly with the thing you put into esriConfig.defaults.map.basemaps
.
Best Answer
The updated answer to this question is to update your JSAPI version. I've tested IE10 with the latest API and it works as expected.