This project is read-only.

Measuring Tool (Please help!)

Aug 3, 2012 at 9:06 AM

Hi

I've written a mapping application in vb.NET using the MapWinGIS control.

Is there a measuring tool I can use to measure distance and area?

If it is possible to use measure plugin in my application, please let me know how.

Thank you

dotnetsa

Aug 6, 2012 at 8:46 AM

It is not possible to use existing plug-ins in your custom application.

You can look at the source code of the measurement plug-in and copy the relevant pieces to your project.

--
Paul

Aug 6, 2012 at 10:49 AM

Thank you very much for the reply.

I have tried using the measurement plug-in code, but when drawing each line of the polygon it is way to slow.

It seems as if the Map1.NewDrawing function takes up all the time.

Is there anyone who successfully implemented a measurement tool in their project?

 

Thank you

dotnetsa

Aug 6, 2012 at 3:15 PM

I have. But it depends on what measurement you are talking about. Calculating a distance based on geographic coordinates isn't that hard. but if you want say a great circle distance then that gets more complicated. What i did was look at formulas to calculate the geodesic distance between two points. Of course you will also have to include projection parameters. One resource i used was the Aviation Formulary http://williams.best.vwh.net/avform.htm.

 

AGP

Aug 7, 2012 at 6:32 AM

What I need in the measurement tool is:

1. Draw a line on the map and show the distance in meters/kilometers.

2. Draw a polygon on the map and show the area in square meters / hectares

--

dotnetsa

Aug 9, 2012 at 7:40 PM

again a line on a map is not really a great circle so will not travel along the curvature of the earth. for small areas the distortion is not that much but for larger areas/distances it is. Take a look at that link for the distance calculation. To draw the line just use the DrawLine and Label functions. http://mapwingis.codeplex.com/documentation

 

AGP

Aug 10, 2012 at 7:32 AM

I've tried using the Drawline function, but everytime the mouse is moved I have to use NewDrawing to draw a new line.

The result is a very slow "sluggish" movement of the line as the mouse is moved.

I was hoping someone already accomplished this and could help me with a tool or code.

Thank you

dotnetsa

Aug 10, 2012 at 7:17 PM

I forget where I got the sample code but I ended up using a derivate of this where the key function is ControlPaint.DrawReversibleLine

http://lists.mapwindow.org/pipermail/forum_activex/2006-January/000689.html

be careful on the actual calculation though. when I tested the line drrawn didnt actually match up with the distance value. What i ended up doing was after the user finished his second click I would manually draw a great circle between the two end points and then calculate a great circle distance. I ended up using the algorithm from here http://www.mapwindow.org/phorum/read.php?3,4171,4261 to draw the final line. not perfect but better than the original.

 

AGP