Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 4 of 4

Converting points to lines

This is a discussion on Converting points to lines within the MapPoint Desktop 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 ...

  1. #1
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    Converting points to lines

    Are there any references available for converting a large number of GPS points (taken every second) into a more managable number of lines?

  2. #2
    brianmcg is offline Junior Member Yellow Belt
    Join Date
    Jan 2003
    Posts
    17

    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.

  3. #3
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    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.

  4. #4
    Winwaed's Avatar
    Winwaed is offline Mapping-Tools.com Black Belt
    Join Date
    Feb 2004
    Location
    Irving,Texas
    Posts
    1,859
    Blog Entries
    60
    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. converting lat lon to x y
    By Dazzer in forum MapPoint Desktop Discussion
    Replies: 7
    Last Post: 02-10-2009, 11:12 PM
  2. Converting my Windows app. to ASP
    By BobFromBoston in forum MapPoint Desktop Discussion
    Replies: 7
    Last Post: 10-17-2005, 01:43 PM
  3. Drawing lines on the map between connected points
    By dave murphy in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 04-14-2005, 08:37 AM
  4. Converting XY to Lat Long
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 11-22-2004, 03:35 AM
  5. connecting points with lines
    By robert hunter in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 09-05-2002, 07:28 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27