Graphic Points

362
1
05-20-2021 06:21 AM
Amitkhillan
New Contributor

I am using below code to draw line over map to calculate distance, But facing challenge as coordinates do not returning accurate value till 7 digits.

mapCenterLongitude and mapCenterLatitude returns values in decimal till 7 digits, but when passed to Graphics() the last digit of coordinates cuts down and returns back only 6 digits

val startPoints= Point(mapCenterLongitude!!.toDouble(), mapCenterLatitude!!.toDouble(), srWgs84) val locationMarker= SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, 0xFF0000FF.toInt(), 10f)

val startLocation = Graphic(startPoints, locationMarker)

0 Kudos
1 Reply
RamaChintapalli
Esri Contributor

Graphics are for representation of the features. For accurate distance measurements, you should convert them to the map's spatial coordinates and calculate them. I see that you already have the map coordinates. If you want screenCoordinates (i.e coordinates from touch events) converted to map's spatial coordinates then you use the geoView.screenTolocation.

Here are some samples that showcase converting screen coordinates to map coordinates.
https://github.com/Esri/arcgis-runtime-samples-android/search?q=screenToLocation

0 Kudos