MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Version 2001 Programatic manipulation

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 ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-06-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Version 2001 Programatic manipulation

I have MapPoint 2001, Can I manipulate this w/ VB(A) to retrieve the Lat, Lon, Distance, route Milesage etc. I am reasonably proficient w/ the various'flavors" of VB(A) and VB itself, but have noted the numerous recommendations to upgrade to at least ver "X" (all well beyond 2001). Unfortunatly, I would be hard pressed to afford the cost as I am retired and have a limited income. The obnly 'reference' I see within the help files concerns generating a com add in to instantiate as a menu item. It doesn't even begin to list the data elements which could then be manipulated via the menu item (re the above)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 11-08-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Response?

Since the original posting, I have struggled to get through the exercise. I have browsed through over 1/2 of the messages and articles posted here in, extracting several to numerous routines and combining them with the (skimpy?) examples from (MapPoint) Help. The Calc Position routine with some help file stufff ... ffff gets a map open (even on screen! - Which I do not really need), and -given a LITERAL for the place to find setting a location object, it will return (calculate) a (single) Lat & Lon. I cannot sem to devise any way to have FIND use a calculated string or string variable. If any one can suggest WHAT the (*&!#$^(*&#^$(A@^( I am doing wrong it would be SISNCERELY appreciated. It would be almost sincerely appreciated If you could even DEFINITIVELY state that Find CANNOT accept anything BUT the literal argument (although THAT seems to make the method of the object USELESS!!!! (?)



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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 11-09-2004
John Meyer's Avatar
Senior Member
Blue Belt
 
Join Date: Jul 2002
Posts: 479
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 11-09-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
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


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
2001, manipulation, programatic, version


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

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


All times are GMT -5. The time now is 07:16 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map


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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55