Select to view content in your preferred language

Display dimensions of polygon / polyline on map

2484
4
02-17-2011 09:55 PM
JollyJacob
Emerging Contributor
Hi,

In our SL web application, we want to be able to display dimensions and angle of polygon / polyline features on the map. And that too aligned correctly to the lines. I believe, in the Javascript API it is done by cutting up the polygon into lines, calculating the measurements and displaying them on the map. Is that possible in the SL API, in any which way?

Thanks
Jolly
0 Kudos
4 Replies
JenniferNery
Esri Regular Contributor
Do you mean showing distance between vertices as in this example?http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#UtilityActions

If not, can you provide a sample from JavaScript API so I can point you to the right direction? Thanks 🙂
0 Kudos
JollyJacob
Emerging Contributor
Thanks Jennifer. Actually no, we were not after dimensions of lines drawn on map by user. What we need to do is - user selects polygon, dimensions of the selected polygon should be displayed along each side. So the system should calculate the length of sides of polygon feature and display it. Would we be able to do that in the SL API? This is kind of mimicking AutoCAD functionality because we are migrating an app written for AutoCAD into a web app.

Regards
Jolly
0 Kudos
DanielWalton
Frequent Contributor
It's easy enough to calculate the lengths of any line segment using the pythagorean theorem. The trick will be to position the labels properly. You might want to create a custom symbol type to do this.
0 Kudos
JollyJacob
Emerging Contributor
Thanks Daniel for your quick reply. Can you please explain how the Pythagorean Theorem can be used to calculate the length when the lengths of none of the sides are known. I guess we need to calculate the length from the coordinates of the endpoints of lines. But would it be possible to do this in the SL API? And is there a better, easier way to achieve this?

Thanks in advance.
Jolly
0 Kudos