Community of MapPoint and Virtual Earth Users and Developers
This is a discussion on Converting points to lines within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Are there any references available for converting a large number of GPS points (taken every second) into a more managable ...
| |||||||
| Today's Posts | Twitter Feed | Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| re: Converting points to lines
You could try something like this (pseudo VB code): ' assuming an array of your GPS latitudes 'aLat', and longitudes 'aLong' dim aObjLocs(0 to Ubound(aLat)) as MapPoint.Location ' now create an array of location objects - one for each GPS fix For n = 0 to Ubound(aLat) Set aObjLocs(n) = objMap.GetLocation(aLat(n),aLong(n)) Next n ' now turn the array of locations into a polyline objMap.Shapes.AddPolyline aObjLocs You'd use the objMap.Shapes.Item(x).Vertices to retrieve and work with the array of locations that make up the Polyline, assuming 'x' is the item in the Shapes collection that you just added. Get this by calling objMap.Shapes.Count right after you call the AddPolyline method. Note: Don't expect this code to work first time. I've probably left out a few things, but it gives the sense of a method that you could try. |
| |||
| Converting points to lines
What I really want to do is reduce the amount of data. For instance, I have a thousand points going in a line down Main Street. Because of the small errors in GPS, the points aren't mathematically in a line, but I want to save the data as a line segment, not as a thousand points. When the points make a left turn at 9th Street, I want to programatically detect that and have another line segment until the points turn or stop. I want my program to go through up to a million points and plot as few line segments on the map as possible. |
| ||||
|
How close are the points and what are the acceptable errors at turns? If they're close and/or acceptable errors are reasonable, then you could do a simple decimation of the data - ie. only keep every other point / every third point / etc. Snapping lines to data points is possible, but you still have to be aware of errors and tolerances. I wrote something to do this in 1d a while ago for reducing finely sampled geophysical data into "segments", based on the "method of least squares". 2d would be more complicated but do-able, and there are some nifty speedups possible if you know what you're doing. Contact me off list (see contact form on website), if you're interested in us writing a program to do this for you. Richard
__________________ Winwaed Software Technology LLC http://www.winwaed.com See http://www.mapping-tools.com for MapPoint Tools See the Geoweb Guru for online mapping |
![]() |
| Tags |
| converting, lines, points |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| converting lat lon to x y | Dazzer | MapPoint 2006/2009 Discussion | 7 | 02-10-2009 10:12 PM |
| Converting my Windows app. to ASP | BobFromBoston | MapPoint 2006/2009 Discussion | 7 | 10-17-2005 12:43 PM |
| Drawing lines on the map between connected points | dave murphy | MapPoint 2006/2009 Discussion | 2 | 04-14-2005 07:37 AM |
| Converting XY to Lat Long | Anonymous | MapPoint 2006/2009 Discussion | 1 | 11-22-2004 02:35 AM |
| connecting points with lines | robert hunter | MapPoint 2006/2009 Discussion | 2 | 09-05-2002 06:28 PM |
Tenerife Holiday
Find a great deal on a Tenerife holiday through UlookUbook! Check out the options online...