Community of VE/MapPoint Users and Developers
This is a discussion on Version 2001 Programatic manipulation within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; I have MapPoint 2001, Can I manipulate this w/ VB(A) to retrieve the Lat, Lon, Distance, route Milesage etc. I ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Version 2001 Programatic manipulation |
| |||
| Response? Code: Public Function basOpenMap(MapPath As String) As Boolean
'Michael Red 11/5/04 First try from Help Exapmples
Dim objMapApp As MapPoint.Application
Dim objMap As MapPoint.Map
Dim objRs As MapPoint.Recordset
Dim objData As MapPoint.DataSet
Dim objLoc As MapPoint.Location
Dim PPinLoc As MapPoint.Location
Dim ILat As Double
Dim iLon As Double
Set objMapApp = New MapPoint.Application
Set objMap = objMapApp.NewMap
Dim Idx As Integer
objMap.SaveAs objMapApp.DefaultFilePath & "\Map.Ptm", geoFormatMap
objMapApp.NewMap
Set objMap = objMapApp.OpenMap(objMapApp.DefaultFilePath & "\" & MapPath & ".PTM")
Set objRs = objMapApp.OpenMap(objMapApp.DefaultFilePath & "\" & MapPath & ".PTM") _
.DataSets("qrySelFlZips").QueryAllRecords
Set objData = objMap.DataSets("qrySelFlZips")
objData.DisplayPushpinMap
'From LITERAL ONLY
Set objLoc = objMap.Find("Tampa, FL")
Call CalcPos(objMap, objLoc, ILat, iLon) '<-Works
Debug.Print ILat, iLon
'From ana attempt to get the several via the string VARIABLE
While Idx < objData.RecordCount
Set PPinLoc = objMap.Find(Chr(34) & objRs.Fields(1) _
& ", FL" & Chr(34))
Call CalcPos(objMap, PPinLoc, ILat, iLon) '<-Works NOT
Debug.Print objRs.Pushpin.Name, objRs.Fields(1), ILat, iLon 'Gives Zip Code (PK) and Name
objRs.MoveNext
Idx = Idx + 1
Wend
End Function
|
| ||||
|
Its good advice to upgrade to MapPoint 2002. It will be frustrating trying to get stuff to work and it will be hard to help you with 2001. (I don't even have a copy anymore I dont think) Everyone uses 2002 or 2004. The big difference in 2004 is updated data. You may be able to get a copy of MapPoint 2002 on ebay for a good price. I did notice in you code sample that you opened/created the map 4 times? Code: Set objMap = objMapApp.NewMap
objMapApp.NewMap
Set objMap = objMapApp.OpenMap(objMapApp.DefaultFilePath & "\" & MapPath & ".PTM")
Set objRs = objMapApp.OpenMap(objMapApp.DefaultFilePath & "\" & MapPath & ".PTM") _ .DataSets("qrySelFlZips").QueryAllRecords
__________________ John http://www.support-pc.com Order MapPoint 2006 Here https://secure.mp2kmag.com/?refer=support-PC |
| |||
|
John, Thanks for at least SOME response. By continued 'due duilengence', I am (S L O W L Y) getting somewhere. I can currently ge a large percentage of the points to work with a string variable using the FIND method. Approx 15% still baffle me. Using the "Find Dialog, I can enter the City name and State and ye olde (and apparently decripit?) MapPoint 2001 goes to the city. Putting the "Same" info in programatically with the string variable, the Finf METHOD fails to generate a Location object. I think much of my earlier difficulty in the use of the string var was the weird, non-standard error handling from MapPooint (at least ver '01). When the methods fail, they do not error, but set the opbject to nothing, but the Distance method fails and returns an actual error. I did eventually find [/b]Is Nothing and can trap the occurance of the failure to find and prevent (ByPass) the call to CalcPos. Alas. Alack and Awry I still can't figure out WHY the find method fails -particularly so often. My first thought was that find was not able to (uniquely) resolve the City-State in htese instances, however using hte text box entry shows tha somewhere over (or at least near) 90% of hte entries return multiple locations, so this appears to not be the basic issue. I haven't yet attempted to Include the Zip code as part of location to Find, however this would be -at best- problematical, as Zip Codes are subject to change and I do not seem to have a reliable (and FREE) source enyway. I MAY go back and re-try t he FinAddress method, but so far at least is is even MORE frostrating than Find, as it SEEMS LIKE the "Street" argument is required. This might be good for a greater level of detail, but I'm only trying to get a general set of locations (to Zip code today, perhaps to census tracts later), not specific street addresses (e.g. not a single building), so I do not even have street names, or bulding / lot information to try this with. I am just starting to manipulate MapPoint, and the code I posted is the progressive results of attempting to combine the various snippets from MApPoing (programming) help (Properties and Methods). I haven't quite yet slowed down enough to get the understanding of the differences in the various methods of instantiating the specific Map. I will review the code a bit and see if I can reduce the number of occurances of instantiating map, In particular, I would like to avoid instantiating the application as a visible object (Window), ofr at least destroy it when the routine(s) are complete. Thanks, again, for responmding, Michael Red |
![]() |
| Tags |
| 2001, manipulation, programatic, version |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| I am using mappoint version 2001. And I want to ha.... | Anonymous | MapPoint 2006/2009 Discussion | 4 | 06-11-2002 02:11 PM |
| i have two questions: i am using mappoint 2001 an.... | Anonymous | MapPoint 2006/2009 Discussion | 1 | 06-03-2002 02:01 PM |
| Quick Review - Safe Software Feature Manipulation Engine for | Anonymous | MP2K Magazine Articles | 0 | 01-31-2002 11:48 PM |
| I have Microsoft Mappoint 2001 and I am trying to .... | Anonymous | MapPoint 2006/2009 Discussion | 1 | 09-25-2001 04:48 AM |
| We are using MapPoint 2001 but hope you can still .... | Anonymous | MapPoint 2006/2009 Discussion | 1 | 07-25-2000 12:24 PM |