PDA

View Full Version : Export "Places" from MapPoint 2010 to Access



Eric Frost
09-30-2009, 10:26 AM
I wrote this Access script/module to grab the Places (restaurants, train stations, etc.) from MapPoint 2010. It's mostly based on this article by John Washenberger from 8 years ago..
Extracting the Mappoint 2002 Points of Interest (http://www.mp2kmag.com/a53--poi.points.interest.mappoint.html)

It's not perfectly user friendly, and it leaks memory and must be restarted a few times, but it works. I found 1,604,176 places in the North / Western Hemisphere. Between Longitude -180 and 0 and Latitude between 0 and 180.

To run, first open MapPoint 2010. Go to View | Show/Hide Places and turn on/off the Places for the categories you want.

Now in the Access database attached, go to Module1. Click Run Sub/UserForm and select ExportPOIs. It will run for a day or so, but MapPoint will eventually crash, I think because of a memory leak. Close MapPoint and re-open it. Note which was the last Latitude row it was working on and in the code, change the For...Next loop for the Latitude to start at your current Latitude. It will probably run for another day or two and crash again. Repeat.

(To get rid of the memory leak issue, you should probably instantiate MapPoint from within the program instead of attaching to it. And reinstantiate it each time it goes to the next Latitude.)

Have fun and let me know if you have any questions or suggestions!

Eric

houstonian
01-28-2010, 10:39 AM
Hi Eric,

It seems working, is it too difficult to have the sub run for the USA only, or can I specify a state or city..

Thanks,

Albert

Eric Frost
01-28-2010, 11:56 AM
Right now it's set to loop over the entire northern hemisphere.

See the For loops with the lat/lon coordinates. You could determine the range of lat/lons you need to cover your area and then modify the values in the for loops. For a city it might be just a single lat/lon since it does a 50 mile radius.

Eric

houstonian
01-28-2010, 01:43 PM
So far so good, now I am strugling to include the Telephone number, I tried to mimic other fields but the sub is not working.. I hope you can help me with this one too.

Thanks,

Albert

Eric Frost
01-28-2010, 02:01 PM
I could never get the telephone number to come out :-/

Eric

houstonian
01-28-2010, 02:02 PM
Thanks

Elgrande
03-22-2010, 04:36 PM
Hi there,

i am trying to use this but get a error message 3346 telling me that the selected fields/values are diferent from the one in te table.

I am ussing the european version of mappoint.

hopy you could help me on this

sql = "INSERT INTO POIs ( Name, Lat, Long, Category, Address, Street, City, Region, Country, PostalCode, iLat, iLong, TimeStamp ) SELECT "
sql = sql & Chr$(34) & strName & Chr$(34) & " AS Expr1, " & CStr(dblLat) & " AS Expr2, "
sql = sql & CStr(dblLong) & " AS Expr3, " & Chr$(34) & strCategory & Chr$(34) & " AS Expr4, "
sql = sql & Chr$(34) & strAddress & Chr$(34) & " AS Expr5, " & Chr$(34) & strStreet & Chr$(34) & " AS Expr6, "
sql = sql & Chr$(34) & strCity & Chr$(34) & " AS Expr7, " & Chr$(34) & strRegion & Chr$(34) & " AS Expr8, "
sql = sql & Chr$(34) & strCountry & Chr$(34) & " AS Expr9, " & Chr$(34) & strPostalCode & Chr$(34) & " AS Expr10, "
sql = sql & CStr(iLat) & " AS Expr11, " & CStr(iLong) & " AS Expr12, " & Chr$(34) & CStr(Now()) & Chr$(34) & " As Expr13;"

This is the VBA what the debuger is selecting

Eric Frost
03-22-2010, 10:44 PM
This sounds familiar. Check the field types and table definition. Something is not right.

Eric