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

Underlying Street Address of POI

This is a discussion on Underlying Street Address of POI within the MapPoint Desktop Discussion forums, part of the Map Forums category; Can anyone provide a solution for this? Using the MapPoint Control both MP2K2 and MP2K4 return a street address 'underlying' ...

  1. #1
    Adrian Sheard is offline Junior Member White Belt
    Join Date
    Sep 2004
    Posts
    2

    Unhappy Underlying Street Address of POI

    Can anyone provide a solution for this?
    Using the MapPoint Control both MP2K2 and MP2K4 return a street address 'underlying' a point of interest e.g. Riverside Cafe, Burbank CA returns 1221 W Riverside Drive, Burbank CA (which is indeed correct). However MP2K6's control (i.e. programmatic access) returns nothing whereas the MP2K6 application manages to display the address in the balloon.

    How can I 'persuade' MP2K6's control to provide the street address just like MapPoint app?
    Adrian Sheard

  2. #2
    Paul Larson is offline Senior Member Green Belt
    Join Date
    Sep 2005
    Location
    Battle Creek, Michigan
    Posts
    136

    Arrow Re: Underlying Street Address of POI

    This is a known issue with MapPoint 2006 and has occasionally even been noted with MapPoint 2004.
    Perhaps it is due in part to licensing agreements with the POI Data Providers.

    The best solution I've come up with is to employ reverse-geocoding techniques to find the nearest address to the POI item.


    Here's a VB.Net module which I use to get around it.
    The module is based on a very convoluted mixture of the reverse-geocoding articles on mp2kmag.com's website which were originally authored by Walt Cygan and Gilles Kohl. Just pass the POI Location to the function "GetNearestLocationAddress" and you'll get something usable back


    '------BEGIN CODE-------------
    Module modAdvancedAddressFuncs
    Public Function GetNearestLocationAddress(ByRef objMap As MapPoint.Map, ByVal OriginalLocation As MapPoint.Location) As MapPoint.Location
    'Gets an address for a Location object using reverse-geocoding brute-force
    'This code is loosely cased on Walt Cygan's article from mp2kmag.com
    Dim objLoc As MapPoint.Location
    Dim objResults As MapPoint.FindResults
    'Attempt to find an address at (approximately) this SAME position.
    'Note this might not actually be the same position, since the current map Altitude
    ' has an increasing effect on the ObjectsFromPoint() method.
    OriginalLocation.GoTo()
    objMap.Altitude = 0.01D
    objResults = objMap.ObjectsFromPoint(objMap.LocationToX(Origina lLocation), objMap.LocationToY(OriginalLocation))
    For Each Result As MapPoint.Location In objResults
    If Not (Result.Location.StreetAddress Is Nothing) Then
    Return Result.Location
    Exit Function
    End If
    Next Result
    'Nothing was found, so recursively attempt to find a "near match."
    'Search at points spiralling outward from the original location.
    'We search at points in the order of North, South, East, West, NE, SE, NW, SW
    ' since nearby roads will most likely be "hit" in those locations.
    Dim ThisLoc As MapPoint.Location
    For DeltaOfs As Double = 0.001D To 0.1D Step 0.001D
    For OctagonPosition As Integer = 1 To 8
    ThisLoc = TryDeltaLoc(objMap, OriginalLocation, OctagonPosition, DeltaOfs)
    If Not (ThisLoc.StreetAddress Is Nothing) Then
    'we found a nearby address, so use Routing to find the start address
    Return FindAddressByRoute(objMap, OriginalLocation, ThisLoc)
    Exit Function
    End If
    Next OctagonPosition
    Next DeltaOfs
    noneFound:
    'if we got this far, then we haven't gotten any hits, so return nothing
    Return Nothing
    Exit Function
    End Function

    Private Function TryDeltaLoc(ByRef objMap As MapPoint.Map, ByVal CenterLoc As MapPoint.Location, ByVal OctagonPosition As Integer, ByVal Offset As Double) As MapPoint.Location
    'Try to geocode at a Delta-ed location by octagon position (rotated coordinate quadrant)
    Dim Lat, Lng As Double
    Lat = CenterLoc.Latitude
    Lng = CenterLoc.Longitude
    Dim DeltaLoc As MapPoint.Location
    Select Case OctagonPosition
    Case 1 'north
    DeltaLoc = objMap.GetLocation(Lat, Lng + Offset)
    Case 2 'south
    DeltaLoc = objMap.GetLocation(Lat, Lng - Offset)
    Case 3 'east
    DeltaLoc = objMap.GetLocation(Lat + Offset, Lng)
    Case 4 'west
    DeltaLoc = objMap.GetLocation(Lat - Offset, Lng)
    Case 5 'NorthEast
    DeltaLoc = objMap.GetLocation(Lat + Offset, Lng + Offset)
    Case 6 'SouthEast
    DeltaLoc = objMap.GetLocation(Lat - Offset, Lng + Offset)
    Case 7 'NorthWest
    DeltaLoc = objMap.GetLocation(Lat + Offset, Lng - Offset)
    Case 8 'SouthWest
    DeltaLoc = objMap.GetLocation(Lat - Offset, Lng - Offset)
    End Select
    'now attempt to reverse geocode at THIS location
    DeltaLoc.GoTo()
    objMap.Altitude = 0.01D
    Dim objResults As MapPoint.FindResults = objMap.ObjectsFromPoint(objMap.LocationToX(DeltaLo c), objMap.LocationToY(DeltaLoc))
    For Each Result As MapPoint.Location In objResults
    If Not (Result.Location.StreetAddress Is Nothing) Then
    Return Result.Location
    Exit Function
    End If
    Next Result
    'if we got nothing, still need to return a valid location object,
    ' so return the original
    Return CenterLoc
    End Function

    Private Function FindAddressByRoute(ByRef objMap As MapPoint.Map, ByVal StartLoc As MapPoint.Location, ByVal NearbyLoc As MapPoint.Location) As MapPoint.Location
    Dim Rte As MapPoint.Route = objMap.ActiveRoute
    'clear any current route data
    If Not (Rte Is Nothing) Then Rte.Clear()
    'create the route from the point we're attempting to geocode to a known-good nearby address
    Rte.Waypoints.Add(StartLoc)
    Rte.Waypoints.Add(NearbyLoc)
    Rte.Calculate()
    'call a single recursion of the original routine
    Return GetNearestLocationAddress(objMap, Rte.Directions.Item(1).Location)
    End Function
    End Module
    '------END CODE-------------


    HTH
    Paul

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. street address from lat/lon... VB style
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 06-09-2005, 02:12 PM
  2. Getting 'second' street address
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 05-06-2004, 10:31 AM
  3. GeoRoadType from Street Address
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 01-25-2004, 06:22 AM
  4. street address limit
    By bob in forum MapPoint Desktop Discussion
    Replies: 5
    Last Post: 11-04-2003, 08:51 AM
  5. Thoughts on War GPS Precision Vs. Underlying Data
    By Anonymous2000 in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 04-02-2003, 02:22 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 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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96