Measuring Distance and Area

In today’s blog post, we will explore a popular GIS function: measuring the length and area of features.

To view this in action, download the WPF ‘HowDoI’ samples and view the ‘Draw, Edit, or Delete Shapes’ sample. This sample demonstrates how to draw lines and polygons that are measured real-time as they are drawn.

 
 

The main functionality of this sample is implemented in the MouseMoved event on the TrackInteractiveOverlay. This event fires anytime the mouse moves while the user is drawing a shape. You can see in the code below that the shape being drawn is in the AffectedFeature property of the event args. Once you have the feature being drawn, it’s a simple matter of using the GetArea method in the AreaBaseShape or the GetLength method in the LineBaseShape to calculate and then display the result in the sidebar.

 
 

While this sample is shown in using ThinkGeo Desktop, it also applies to our Web and Mobile components. Sign up today to download our samples and view this in action!

Previous
Previous

ThinkGeo Basics: Feature Sources

Next
Next

Revisiting Offline Maps