I was wondering if there was any direct method to do reverse geocoding. I have a lat/long and need to get a block address from it, but i haven't been able to find a clear way of doing this. Is there any code out there to show me what I need to do?
This is a discussion on I was wondering if there was any direct method to .... within the MapPoint Desktop Discussion forums, part of the Map Forums category; I was wondering if there was any direct method to do reverse geocoding. I have a lat/long and need to ...
I was wondering if there was any direct method to do reverse geocoding. I have a lat/long and need to get a block address from it, but i haven't been able to find a clear way of doing this. Is there any code out there to show me what I need to do?
The snippet below (meant to be used with MapPoint 2002) demonstrates a way
how it can done.
It creates a location using given lat and lon, and uses the
ObjectsFromPoint method of the map object to retrieve a FindResults
collection. It then outputs the name of the first (and usually best) hit:
<form><textarea wrap="off" readonly="true" name="code"
style="BORDER-BOTTOM:
gray 1px inset; BORDER-LEFT: gray 1px inset; BORDER-RIGHT: gray 1px inset;
BORDER-TOP: gray 1px inset; OVERFLOW: auto; WIDTH: 100%" rows="26"
cols="40">
Option Explicit
Dim oMpApp As MapPoint.Application
Private Sub Command1_Click()
' Attach to running instance of MapPoint
Set oMpApp = GetObject(, "MapPoint.Application")
' Retrieve the active map
Dim oMap As MapPoint.Map
Set oMap = oMpApp.ActiveMap
Dim oLoc As MapPoint.Location
Set oLoc = oMap.GetLocation(40.778, -124.1827, 1)
oLoc.GoTo
' Altitude of 1 and Goto important - better
' results from ObjectsFromPoint
Dim Rs As MapPoint.FindResults
Set Rs = oMap.ObjectsFromPoint( _
oMap.LocationToX(oLoc), _
oMap.LocationToY(oLoc))
MsgBox Rs.Item(1).Name
End Sub
</textarea></form>
More details and another sample can be found in the documentation of the
FindResults object - you'll probably want to check results quality,
retrieve alternative hits , and retrieve additional info about the found
locations. Note that this is not guaranteed to get you a street address.
There are currently 1 users browsing this thread. (0 members and 1 guests)