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 3 of 3

Finding a country or a city

This is a discussion on Finding a country or a city within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi, Anyone knows if it is possible to find the city which matches with a latitude/longitude given? I'm using Visual ...

  1. #1
    wintermute is offline Junior Member White Belt
    Join Date
    Dec 2003
    Posts
    2

    Finding a country or a city

    Hi,

    Anyone knows if it is possible to find the city which matches with a latitude/longitude given? I'm using Visual Basic and Mappoint Europe 2002.

    Thanks for all your answers.

  2. #2
    Eric Frost's Avatar
    Eric Frost is offline Administrator Black Belt
    Join Date
    Jul 1992
    Posts
    5,094
    Blog Entries
    4
    This isn't an easy task, but shouldn't be terribly difficult either. See the reverse geocoding articles, I think there should be something in there for you.

    Eric
    ~ Order MapPoint MapPoint 2013 Here and Get Free Access to the MapForums Downloads ~
    ~~
    ~ Upgrade to Get Access to the MapForums Downloads ~

  3. #3
    wintermute is offline Junior Member White Belt
    Join Date
    Dec 2003
    Posts
    2
    Hi,

    I've tried the example code about geocoding, and it works perfectly... but I have a new problem.

    I'm modfying that example with this:

    Set oLoc = oMap.GetLocation(dblLat, dblLon, 1)
    Set oLoc2 = oMap.GetLocation(42.35, -5.9)
    Set oLoc3 = oMap.GetLocation(42.35, -10)

    Set oRte = oMap.ActiveRoute
    oRte.Clear

    'When I comment this, it works fine.
    With oRte.Waypoints
    .Add oLoc
    .Add oLoc2
    .Add oLoc3
    End With

    oRte.Calculate
    'zoom.
    oRte.Directions.Location.GoTo

    With this little change, the program fails when going through the loop in ShowResults.

    ' ShowResults: Show the contents of a FindResults collection
    Private Sub ShowResults(sTitle As String, oRes As MapPoint.FindResults, _
    oOrgLoc As MapPoint.Location)
    ' Add the title to the listbox
    List1.AddItem sTitle

    ' Show the results quality
    List1.AddItem "Results Quality: " & oRes.ResultsQuality

    ' define a generic object to iterate over FindResults
    Dim oObj As Object

    ' Define a location and a pushpin object - these will
    ' be used according to the actual object type
    Dim oLoc As MapPoint.Location

    Dim oPin As MapPoint.Pushpin
    Dim n As Integer

    ' Loop over collection
    MsgBox "Tiene: " & oRes.Count
    For Each oObj In oRes
    Dim sTxt As String

    ' Number the objects
    n = n + 1
    sTxt = n & ") "

    ' Find out object type
    If TypeOf oObj Is MapPoint.Location Then
    Set oLoc = oObj ' Use Location object

    sTxt = sTxt & "Location: " & oLoc.Name

    ' do we have place category information ?
    If Not oLoc.PlaceCategory Is Nothing Then
    sTxt = sTxt & ", Cat=" & oLoc.PlaceCategory.Name
    Else
    sTxt = sTxt & ", Cat=None"
    End If

    ' add location type info
    sTxt = sTxt & ", Type=" & oLoc.Type

    ' do we have street address information ?
    If Not oLoc.StreetAddress Is Nothing Then
    sTxt = sTxt & ", Adr=" & oLoc.StreetAddress
    Else
    sTxt = sTxt & ", Adr=None"
    End If

    ' add distance to original spot
    sTxt = sTxt & ", Dist=" & _
    Format(oLoc.DistanceTo(oOrgLoc), "##0.00")
    ' ElseIf TypeOf oObj Is MapPoint.Pushpin Then
    ' ' Not a location but a pushpin, use this object
    ' Set oPin = oObj
    ' sTxt = sTxt & "PushPin: " & oPin.Name
    ' sTxt = sTxt & ", Note=" & oPin.Note
    Else
    ' Unknown object - we know nothing about it
    ' (This should not happen except in future
    ' versions of MapPoint)
    sTxt = "Unknown object"
    End If

    ' Add the info line to the listbox
    List1.AddItem sTxt

    Next oObj

    ' Add an empty line
    List1.AddItem ""
    End Sub

    Do you know why?

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Get country for lat & lon
    By zauber in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 07-11-2005, 09:04 PM
  2. City, State and Country info for a loc found using lat/lng
    By lavend in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 04-28-2004, 03:17 PM
  3. Staging-Geocoding by city instead of country/region
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 04-02-2004, 04:24 PM
  4. Removing city/ and or country names
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 10-15-2003, 03:57 PM
  5. One country view only?
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 04-18-2003, 11:45 AM

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