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

Getting Lat/Lon from a given address

This is a discussion on Getting Lat/Lon from a given address within the MapPoint Desktop Discussion forums, part of the Map Forums category; I use this routine in my application: Private Sub Befehl0_Click() Dim objApp As New MapPoint.Application Dim objFindResults As MapPoint.FindResults objApp.Visible ...

  1. #1
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    Getting Lat/Lon from a given address

    I use this routine in my application:

    Private Sub Befehl0_Click()
    Dim objApp As New MapPoint.Application
    Dim objFindResults As MapPoint.FindResults

    objApp.Visible = False
    objApp.UserControl = True

    'Erstes Ergebnis der Suche ausgeben
    Set objFindResults = objApp.ActiveMap.FindAddressResults("Römerstraße 12", "Düren", , , "52349", geoCountryGermany)
    MsgBox "Das erste Element in der Ergebnisliste lautet: " _
    + objFindResults.Item(1).Name
    objApp.Application.Quit
    End Sub


    But instead of the name of I would like to get back Lat/Lon. Is this possible?
    Ralf

  2. #2
    Eric Frost's Avatar
    Eric Frost is offline Administrator Black Belt
    Join Date
    Jul 1992
    Posts
    5,094
    Blog Entries
    4
    It is.. see Gilles Kohl's article "A More Compact Method for Obtaining the Lat/Lon" in the articles section..

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

  3. #3
    rms62 is offline Junior Member White Belt
    Join Date
    Jun 2003
    Posts
    9
    I saw the article but isn´t there simpler way to get lat/lon from the FindAdressResult?
    I don´t understand how I can get lat/lon from the given addresses with Gill Kohl´s routine.
    Ralf

  4. #4
    Eric Frost's Avatar
    Eric Frost is offline Administrator Black Belt
    Join Date
    Jul 1992
    Posts
    5,094
    Blog Entries
    4
    There's not an easier way.. err, there are some compiled tools that use Gilles routine that you can use without programming, but using programming Gilles CalcPos is the way to go.

    First create the Location or Pushpin and then use the CalcPos function to get the lat/lon. You could probably make a wrapper so it's all done in one step.

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

  5. #5
    rms62 is offline Junior Member White Belt
    Join Date
    Jun 2003
    Posts
    9
    Sorry but can you help me again?
    I´m not able to call the function CalcPos.

    Here is my routine:

    Private Sub Befehl0_Click()
    Dim MPApp As New MapPoint.Application
    MPApp.Visible = True
    MPApp.UserControl = True
    Dim oMap As MapPoint.MAP, oLoc As Object, Strasse As String, Plz As String, stadt As String
    Dim oPin As MapPoint.Pushpin
    Dim objResults As MapPoint.FindResults
    Dim strRevAddress As String
    Dim lat As Double, lon As Double
    Set oMap = GetObject(, "MapPoint.Application").ActiveMap
    Strasse = "Römerstraße 12"
    Plz = "52351"
    Ort = "Düren"
    Set oLoc = oMap.FindAddressResults(Strasse, Ort, , , Plz, geoCountryGermany)
    Call CalcPos(oMap, oLoc.Location, lat, lon)
    MsgBox oLoc.Item(1).Name & lat & " " & lon
    End Sub


    I allways get an error.

  6. #6
    jwhitt4u is offline Junior Member White Belt
    Join Date
    Aug 2003
    Posts
    5
    For the second argument of calcpos try using a mappoint.location object.
    Define for instance the following

    dim oLoc as mappoint.location

    then do everything else the same and in the calcpos call just use oLoc instead of oLoc.location

    hope this works

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. odd and even address
    By chris2 in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 05-24-2006, 12:07 PM
  2. Anyone willing to look up an address for me?
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 11
    Last Post: 02-07-2004, 08:09 PM

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