Scalebar API

3467
4
05-14-2012 12:31 AM
tuannguyen3
New Contributor
Hi everybody,
Currently, I find many ways yo add scale bar to Arcgis map on Android but it does not seem supporting that. Can everybody help me to solve this problem.

Thank you very much.
0 Kudos
4 Replies
SimonKlein
Occasional Contributor
For now there seems no SDK provided way to do this easily, or I just haven't found it sorry.
0 Kudos
tuannguyen3
New Contributor
Thank you for your answer. But is there any way to caculate length from point A to point B?
0 Kudos
GwenRoyakkers1
New Contributor
Thank you for your answer. But is there any way to caculate length from point A to point B?


Yes there is a way.

The MapView class has a function toMapPoint(float screenx, float screeny).

You could use this function to determine the real distance between two points, and use it to draw a scalebar yourself.

calculating the length itself:

Point strtPoint = mapview.toMapPoint(screenX1, screenY1);
Point endPoint = mapview.toMapPoint(screenX2, screenY2);
Line line = new Line();
line.setStart(strtPoint);
line.setEnd(endPoint);
double length = line.calculateLength2D();


Regards

Gwen
0 Kudos