I am trying to place a locate button widget on my map. My map is in UTM29 projection and it seems that locate button only work withgeographical coordinates. When I set an ESRI map to background map, it works.
I have a script which can convert the input coordinates to WGS84, but I am not able to find out how to pass the converted coordinates to the locate button. Is there any way how to get locate button to work with different projection (coordinate system)?
in this case it sounds like Martin isn't talking about the measurement widget, but rather the 'locate' widget, but the guiding principle is much the same.
geolocation in html5 always returns wgs84 lat/long coordinates for user positions. our JavaScript API includes clientside utility methods for converting between wgs84 and web mercator (because of their widespread use) so it is possible using the out of the box widget to display the user's location on a web mercator basemap.
if you need to convert wgs84 coordinates into another projection, you would either have to write your own clientside conversion utility or rely on an ArcGIS Server geometry service to do the heavy lifting for you. because the locate widget does not allow you to inject coordinates that you reprojected using a custom utility or geometry service, my best suggestion is digging into the source of the widget yourself if you'd like to repurpose its logic.
The measurement tools only work with one coordinate system. Here are two threads with lots of responses on the issue. IMHO it seems kinda crazy for a variety of reasons but that is just me.
Basically, what you have to do is get the results - convert them to your coordinate system then modify the results pane to show the desired results. However, my code to show the correct results is no longer working since I changed API versions.
in this case it sounds like Martin isn't talking about the measurement widget, but rather the 'locate' widget, but the guiding principle is much the same.
geolocation in html5 always returns wgs84 lat/long coordinates for user positions. our JavaScript API includes clientside utility methods for converting between wgs84 and web mercator (because of their widespread use) so it is possible using the out of the box widget to display the user's location on a web mercator basemap.
if you need to convert wgs84 coordinates into another projection, you would either have to write your own clientside conversion utility or rely on an ArcGIS Server geometry service to do the heavy lifting for you. because the locate widget does not allow you to inject coordinates that you reprojected using a custom utility or geometry service, my best suggestion is digging into the source of the widget yourself if you'd like to repurpose its logic.
Thank you for the answer. This just confirms my conclusion. I have created a function which converts the coordinates, and hoped that I could pass them to the geolocate widget. Unfortunatelly, this is not possible. Maybe a good idea for a new feature in the future.