AnsweredAssumed Answered

show coordinates won't work in 4.x

Question asked by xennn on Apr 20, 2018
Latest reply on Apr 24, 2018 by ubatsukh-esristaff

I would like to show coordinates on map. I used these codes but I couldn't work. 


var map = new Map({
basemap: "streets",
layers: [tempGraphicsLayer]


var view = new MapView({
container: "viewDiv",
map: map,
center: [32.909550, 40.751906],
zoom: 9



function showCoordinates(event) {
//the map is in web mercator but display coordinates in geographic (lat, long)
var mp = webMercatorUtils.webMercatorToGeographic(event.mapPoint);
//display mouse coordinates
dom.byId("info").innerHTML = mp.x.toFixed(3) + ", " + mp.y.toFixed(3);


view.on("load", function () {
//after map loads, connect to listen to mouse move & drag events
view.on("mouse-move", showCoordinates);
view.on("mouse-drag", showCoordinates);


 <span id="info" style="position:absolute; left:100px; bottom: 100px; color:#0079c1; z-index:50;"></span>