Select to view content in your preferred language

GET XY of center of map

3089
12
09-23-2019 12:30 PM
jaykapalczynski
Honored Contributor

Can I call and set the XY location of center of the map with a button to variables?  Any example?

Maybe each time the map moves it resets the variables?

0 Kudos
12 Replies
jaykapalczynski
Honored Contributor

On my button I can do this...But need to figure out how to convert to UTM Zone 17N NAD83

Even if I reference a spatial reference in the map....it still spits out Web Aux Sphere 

spatialReference: SpatialReference { wkid:26917 }

var centercoord7 = mapView.currentViewpointCenter.center.x
  console.log("centercoord7 : " + centercoord7);

var centercoord8 = mapView.currentViewpointCenter.center.y
  console.log("centercoord8 : " + centercoord8);‍‍‍‍‍

I tried this but not putting it into UTM Zone 17N Nad83

var centercoord2 = CoordinateFormatter.toUtm(mapView.currentViewpointCenter.center, Enums.UtmConversionModeNorthSouthIndicators, 10);

					
				
			
			
				
			
			
				
			
			
			
			
			
			
		
0 Kudos
jaykapalczynski
Honored Contributor

I can convert the Web Aux Sphere to Lat Long like this

 

Anyone know how I can convert to UTM Zone 17N NAD83??????

 

var centercoord = CoordinateFormatter.toLatitudeLongitude(mapView.currentViewpointCenter.center, Enums.LatitudeLongitudeFormatDecimalDegrees, 6)
0 Kudos
jaykapalczynski
Honored Contributor

I finally found this....just need to find a way to pass the center point to this code and think I can work from there....

THANK YOU for all your help Keith....it is very appreciated!!!!!!! Cheers

Format coordinates | ArcGIS for Developers 

0 Kudos