How would I customize a map tool so as to be able to enter x,y coordinates manually to create an object such as a point and zoom to it?
I have the simple code below:
on(dom.byId("btnFindCoordinates"), "click", function() {
map.graphics.clear();
var x = dom.byId("xCoord").value;
var y = dom.byId("yCoord").value;
var coordPoint = new Point(x,y);
prjParams.geometries = [coordPoint];
map.centerAndZoom(coordPoint, 11);
map.graphics.add(new Graphic(coordPoint, markerSymbol));
});
But not sure how I would add this into the map, I am aware that I want to write a .js file like the attached in order to work with our cityworks map! I highly appreciate if someone can help me to write the code above similar to the attached in order to add it the our map.
Thank you in advance
Best
Majdoleen
Recently, I did create a little app - with the ArcGIS API for JavaScript 4.x - with a custom tool to enter WGS84 Coordinates to zoom to a certain point, see screen capture attached.
You can find (the source code of) the app here:
ArcGIS JavaScript Tutorial - Go to Latitude/Longitude
I hope this provides you with some inspiration to integrate this functionality in your app.
Cheers,
Egge-Jan
Thank you so much for sharing your sample, uniformly I am new to API and trying to write the js file, but I think it will cost me a lot of time. I highly appreciate if you can guide meto write your code equivalent to the one I attached in my question.
Thank you in advance
Best
Majdoleen