...coordinates tool ... Are there any samples out there or does anyone have any ideas?
You might find these samples useful:
https://developers.arcgis.com/javascript/jssamples/util_project.html
https://developers.arcgis.com/javascript/jssamples/util_coordinate_converter.html
hi Ian,
have you found the solution? Same like me now, want to develop tool for find coordinate like yours.. Can you help me how to code it?
Thanks,
Regards,
Nana 😃
Nana,
My apologies for the late response. I do have a sample I can send. Do you want me to send it by email or another method? There is still some minor modifications that need to be done, but I think it will get you started.
Hi,
Thanks for your feedback.
U can send it by email.
Thanks ya 😃
Regards,Nana
function zoomToPoint (x,y) { var point = webMercatorUtils.geographicToWebMercator(new Point(x, y, map.spatialReference)); map.centerAndZoom(point,15); var tempPoint = map.graphics.add(new Graphic(point, config.gotoPoint)); window.setTimeout(function(){map.graphics.remove(tempPoint);},3000); // on.once(map, "click", function(){ // map.graphics.remove(tempPoint); // }); }
/*jslint browser: true, nomen: true */ /*jshint dojo, jquery, nomen:false */ /*global jQuery */ (function ($) { "use strict"; // Matches DMS coordinates // http://regexpal.com/?flags=gim®ex=^(-%3F\d%2B(%3F%3A\.\d%2B)%3F)[°%3Ad]%3F\s%3F(%3F%3A(\d%2B(%3F%3A\.\d%2B)%3F)['�?�%3A]%3F\s%3F(%3F%3A(\d%2B(%3F%3A\.\d%2B)%3F)["�?�]%3F)%3F)%3F\s%3F([NSEW])%3F&input=40%3A26%3A46N%2C79%3A56%3A55W 40%3A26%3A46.302N 79%3A56%3A55.903W 40°26�?�47�?�N 79°58�?�36�?�W 40d 26�?� 47�?� N 79d 58�?� 36�?� W 40.446195N 79.948862W 40.446195%2C -79.948862 40° 26.7717%2C -79° 56.93172 var dmsRe = /^(-?\d+(?:\.\d+)?)[°:d]?\s?(?:(\d+(?:\.\d+)?)['�?�:]?\s?(?:(\d+(?:\.\d+)?)["�?�]?)?)?\s?([NSEW])?/i; // Results of match will be [full coords string, Degrees, minutes (if any), seconds (if any), hemisphere (if any)] // E.g., ["40:26:46.302N", "40", "26", "46.302", "N"] // E.g., ["40.446195N", "40.446195", undefined, undefined, "N"] /** Parses a Degrees Minutes Seconds string into a Decimal Degrees number. * @param {string} dmsStr A string containing a coordinate in either DMS or DD format. * @return {Number} If dmsStr is a valid coordinate string, the value in decimal degrees will be returned. Otherwise NaN will be returned. */ function parseDms(dmsStr) { var output = NaN, dmsMatch, degrees, minutes, seconds, hemisphere; dmsMatch = dmsRe.exec(dmsStr); if (dmsMatch) { degrees = Number(dmsMatch[1]); minutes = typeof (dmsMatch[2]) !== "undefined" ? Number(dmsMatch[2]) / 60 : 0; seconds = typeof (dmsMatch[3]) !== "undefined" ? Number(dmsMatch[3]) / 3600 : 0; hemisphere = dmsMatch[4] || null; if (hemisphere !== null && /[SW]/i.test(hemisphere)) { degrees = Math.abs(degrees) * -1; } if (degrees < 0) { output = degrees - minutes - seconds; } else { output = degrees + minutes + seconds; } } return output; } // Add coordinate validation method to jQuery validator. if (typeof ($.validator) !== "undefined") { $.validator.addMethod("coordinate", function (value, element) { return this.optional(element) || dmsRe.test(value); }, "Please enter a Decimal Degree or DMS value."); } $.parseDms = parseDms; }(jQuery));