PDA

View Full Version : Extracting Coordinates of a Route



Eric Frost
05-01-2011, 01:45 PM
This is a new tool which lets you extract the approximate coordinates of a route object.

If does this by adding a rest stop every 1 minute and programmatically setting all the speeds to 1 mile per hour, and then looping over all the directions and writing out their coordinates which approximates the coordinates of the route.

I say the the coordinates of the directions approximate the coordinates of the route, because they don't capture every turn, and where there are turns or curves, they do not necessary always fall exactly on the route.

In any case, it would be good enough for many visualization purposes.

This was originally developed based on ideas posted and discussed by Mattys Consulting (http://www.mapforums.com/mattys-consulting-member.html), blue jay (http://www.mapforums.com/blue-jay-member.html), Wilfried (http://www.mapforums.com/wilfried-member.html), and Winwaed (http://www.mapforums.com/winwaed-member.html) in this thread: http://www.mapforums.com/how-get-gps-coordinates-interval-route-mappoint-15120.html

Instructions

Download and unzip the attachment below.

When you open the Excel file, be sure to Enable Macros or Options | Enable this content -- depending on your version of Excel, the screenshot below it from Excel 2007.

http://www.mapforums.com/images/enable_content.gif

Next -- click Sample Data to generate a sample route between Chicago and St. Louis, then click Begin to set the routing parameters (slow speeds and lots of rest stops) and write out the coordinates of the route.

You could then save the spreadsheet import all the lat/lon's back up top of the route (you can use the named range "Sequence") to see how well the extracted direction coordinate match the route.

http://www.mapforums.com/images/route_extract.gif

One improvement I can see just looking at the screenshot above is to make Interstates and Toll Roads "preferred" as otherwise with all speeds set to 1 mph, it always takes the shortest network path often on local roads which would not make sense for a city-to-city trip. Alternatively you could set the interstate and highways speeds to 2 mph.

Have fun and let me know if you see any other ways to make improvements or if you have any requests!

Eric

DBurgess
05-06-2011, 11:11 AM
This is my first post and have a question on the extracting coordinates of a route application.

I attempted to us the app but am getting an compile error. The message is "method or data member not found". I am using MapPoint 2006, if that makes any differentce. I follow the instructions and have open instance of MapPoint with a route already calculated. By "calcaulated" i take it to mean that i have one map point as my beginning and another map point at the ending of my route. I then get the directions. i then hit the "begin" button in the Ecell application. That is when the error message appears. What am I going wrong?

Thanks, Don Burgess

Eric Frost
05-06-2011, 02:50 PM
Is there a particular line or something that it highlights when it hangs up?

I only tested with MapPoint 2011, and it's possible there's some new property or method I'm using that didn't exist with MapPoint 2006.

They added a lot with the release of the MapPoint 2010 version.

Eric

Eric Frost
05-06-2011, 02:51 PM
Do you want to post your PTM file as a zip attachment? I can test.

DBurgess
05-09-2011, 07:04 AM
Actually, there was a line in the code that hung up. the line with the word "zoom" was messing it up. I just deleted that line and the app worked just fine.

Thanks for the reply.

Don

Eric Frost
05-09-2011, 07:58 AM
Ah yeah, the .ZoomTo method of the route object was added with MapPoint 2010.. previously the .ZoomTo method only worked with the DataSet object or DataSets collection.

The list below is from the MapPoint 2010 Help file --

Methods
The new methods for Microsoft MapPoint 2010 are:

ImportGPX (Application and MappointControl objects)
ExportGPX (Application and MappointControl objects)
Reverse (Route object)
UpdateConstruction (Route object)
ZoomTo (Route object)
BasicRenderingOnly (Map object)
DefaultRendering (Map object)
ShowInOnlineMap (Map object)
SendToMobile (Map object)
ExportToExcel (SelectedArea object)

DBurgess
05-20-2011, 01:42 PM
Eric,

I used the extraction excel file to obtain GPS points along a route and the program work great. However, I would like to obtain coordinates at equal intervals along the route, if possible. Do you know of a program that does that? I can force the current program to approximate want i want but that entails adding way points along the route which takes a long time.

Thanks,

Don Burgess

Eric Frost
05-20-2011, 03:26 PM
Equal intervals -- it's not doing that? It should be stopping every minute for a rest stop and the speeds for all roads are set to 1 mph, so I would think they are fairly equal intervals? I guess not if you are asking. I remember noticing this when I was doing screenshots, but didn't measure the extent.

In any case, unfortunately I'm not sure what can be done. Anyone else have ideas?

Eric

Mattys Consulting
01-13-2012, 09:15 AM
I did this a few years ago for a company requiring stops every x-amount of feet for the purpose of picking up handicapped/seniors nearby their homes.

The program worked well, but there were shortfalls going around clover-leaf highway-exits and such.

Anyway, I would be willing to work on it again to adapt to your needs
(ie; it is custom development and I do not make source code available.)

Eric Frost
01-13-2012, 09:25 AM
Michael, did you post this in the wrong thread? This was from last May :-)

Eric

Mattys Consulting
01-13-2012, 09:39 AM
I don't usually post outside the regular forum, but I saw this and I'm aware that there are others looking for such development.

Eric Frost
01-13-2012, 09:44 AM
There was a recent thread related to this topic, I thought maybe you had intended to post here -- http://www.mapforums.com/possible-export-mappoint-route-polyline-wkt-18727.html

Mattys Consulting
01-13-2012, 10:00 AM
Ah - lost my train of thought (phone call threw me off). Thanks for putting me back on track!