MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Reverse Geocoding, Pt. III

This is a discussion on Reverse Geocoding, Pt. III within the MP2K Magazine Articles forums, part of the Map Forums category; Walt Cygan, a frequent contributor of late, submits this solution for tackling reverse geocoding Read the full article: http://www.mp2kmag.com/articles.asp?ArticleID=50...


Go Back   MapPoint Forums > Map Forums > MP2K Magazine Articles

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



Click here to register

Reply

 

LinkBack (3) Thread Tools Display Modes
  3 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 10-31-2001
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Reverse Geocoding, Pt. III

Walt Cygan, a frequent contributor of late, submits this solution for tackling reverse geocoding

Read the full article: http://www.mp2kmag.com/articles.asp?ArticleID=50
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 12-17-2003
Member
Yellow Belt
 
Join Date: Feb 2003
Posts: 48
I have a similar/simpler/less accurate(but good enough for my purposes) method which I call when a point on the map is clicked, passing in the location's X and Y values:

Code:
Function FindNearestAddress(locX As Long, locY As Long) As String
'Mossoft2003
    Dim dblTolerance    As Double
    Dim blnFound        As Boolean
    Dim lngCount        As Long
    Dim fr      As MapPoint.FindResults
    Dim sa      As MapPoint.StreetAddress
    Dim obj     As Object
    Dim lngAttempt  As Long
    Dim ToleranceStep   As Long
    Dim dX      As Long
    Dim dY      As Long
    Const ALTITUDE_LIMIT = 15
    
    On Error Resume Next
    
    If mapWhere.ActiveMap.Altitude < ALTITUDE_LIMIT Then
    
        blnFound = False
        lngAttempt = 0
        ToleranceStep = ALTITUDE_LIMIT - mapWhere.ActiveMap.Altitude
        dX = locX
        dY = locY

        Do
            Set fr = mapWhere.ActiveMap.ObjectsFromPoint(dX, dY)
            For Each obj In fr
                Set sa = obj.StreetAddress
                If Not sa Is Nothing Then
                    FindNearestAddress = sa.Value & " (" & CStr(mapWhere.ActiveMap.Distance(mapWhere.ActiveMap.XYToLocation(locX, locY), obj)) & " miles)"
                    blnFound = True
                    Exit For
                End If
            Next
            If blnFound Then Exit Do
            lngAttempt = lngAttempt + 1
            Select Case lngAttempt Mod 8
                Case 1
                    dX = locX
                    dY = locY + ToleranceStep
                Case 2
                    dX = locX + ToleranceStep
                    dY = locY + ToleranceStep
                Case 3
                    dX = locX + ToleranceStep
                    dY = locY
                Case 4
                    dX = locX + ToleranceStep
                    dY = locY - ToleranceStep
                Case 5
                    dX = locX
                    dY = locY - ToleranceStep
                Case 6
                    dX = locX - ToleranceStep
                    dY = locY - ToleranceStep
                Case 7
                    dX = locX - ToleranceStep
                    dY = locY
                Case 0
                    dX = locX - ToleranceStep
                    dY = locY + ToleranceStep
                    ToleranceStep = ToleranceStep + 1
            End Select
        Loop While Not blnFound And ToleranceStep < (2 * ALTITUDE_LIMIT)
    End If
    
FNA_Exit:
    Exit Function
FNA_Error:
    Debug.Print "ERROR: " & Err.Description
    Resume FNA_Exit

End Function
The search pattern is an 8 pointed star eminating, and spiralling out, from the original point.
The altitude check is to ensure the view point is low enough to display address level locations.

M.
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
geocoding, iii, reverse


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/reverse-geocoding-pt-iii-650.html

Posted By For Type Date
Get zip codes from addresses or lat long :: NNSeek This thread Refback 03-12-2007 11:24 AM
Google Groupes : microsoft.public.mappoint This thread Refback 01-22-2007 05:33 AM
Google Groups: microsoft.public.mappoint This thread Refback 01-10-2007 09:57 AM

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
Reverse Geocoding Anonymous News and Announcements 30 07-26-2006 12:21 PM
Reverse geocoding with c# ayazaliuk MapPoint 2006/2009 Discussion 3 06-16-2005 07:52 AM
Reverse GeoCoding Anonymous MapPoint 2006/2009 Discussion 1 04-16-2004 11:56 AM
reverse geocoding Anonymous MapPoint 2006/2009 Discussion 1 01-26-2004 11:15 PM
Reverse Geocoding Anonymous MapPoint 2006/2009 Discussion 1 01-26-2004 01:30 PM


All times are GMT -5. The time now is 09:59 PM.


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