MapPoint Forums

MapForums

Community of MapPoint and Virtual Earth Users and Developers




When I enter just a zipcode in MapPoint, it return....

This is a discussion on When I enter just a zipcode in MapPoint, it return.... within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; When I enter just a zipcode in MapPoint, it returns <Zipcode>, <State>, <Country> but not the city. Is it possible ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

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



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-30-2002
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
When I enter just a zipcode in MapPoint, it returns <Zipcode>, <State>, <Country> but not the city. Is it possible to get this information somehow?

For example, I enter 46038 in MapPoint and search for it. MapPoint returns "46038, Indiana, United States". I cannot determine the city from StreetAddress object because it is set to nothing in this instance. Is there way to get the city for this zipcode? (which is Fishers in this case).
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 05-30-2002
Senior Member
Green Belt
 
Join Date: Aug 2002
Posts: 124
I don't remember where this code originally came from (Gilles Kohl?), but here it is. It returns "Fishers area" for 46038.
<pre>
Private Sub cmdGetCity_Click()
Dim oMap As MapPointCtl.Map
Dim oCityLoc As MapPointCtl.Location

'Set the map object to the current map
Set oMap = ctlMapPoint.ActiveMap

Dim zipCode As String
zipCode = txtZip.Text

Set oCityLoc = FindCityForZipCode(zipCode, oMap)
If Not (Nothing Is oCityLoc) Then
txtCity = oCityLoc.Name
Else
txtCity = "Couldn't find city for this ZIP Code."
End If

End Sub

Function FindCityForZipCode(strZip As String, oMap As MapPointCtl.Map) As MapPointCtl.Location
Dim oZipLoc As MapPointCtl.Location
Dim oZipResults As MapPointCtl.FindResults

Set oZipResults = oMap.FindAddressResults(, , , , strZip, "USA")

' If it’s not a good match, then don’t accept it
If geoFirstResultGood = oZipResults.ResultsQuality Then
Set oZipLoc = oZipResults(1)
Else
Exit Function
End If

' Must be a match to a Post Code (US ZIP Code)
If Not (geoShowByPostal1 = oZipLoc.Type) Then
Exit Function
End If

' Go to the ZIP Code location on the map to hit test
oZipLoc.GoTo
Dim x As Integer
Dim Y As Integer
x = oMap.LocationToX(oZipLoc)
Y = oMap.LocationToY(oZipLoc)

' Find all geographic entities at that point
Dim oContext As MapPointCtl.FindResults
Set oContext = oMap.ObjectsFromPoint(x, Y)

' Return the city at that point (if any)
For Each obj In oContext
If geoShowByCity = obj.Type Then
Set FindCityForZipCode = obj
Exit Function
ElseIf geoShowByDefault = obj.Type Then
Set FindCityForZipCode = obj
End If
Next obj

End Function
</pre>


- Walt Cygan

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
enter, mappoint, return, zipcode


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
Can you enter GPS coordinates and make a pushpin? tonyc789698 MapPoint 2006/2009 Discussion 3 11-26-2004 08:35 PM
Can Mappoint 3.0 SDK return Latitude Longitude coordinates? Anonymous MapPoint 2006/2009 Discussion 1 01-27-2004 05:56 PM
newbie wants help in getting mappoint to return coordinates Anonymous MapPoint 2006/2009 Discussion 1 05-02-2003 02:36 PM
MapPoint 2002 appears to already have zipcode boun.... Anonymous MapPoint 2006/2009 Discussion 1 07-30-2002 12:43 PM
Is it possible to enter a City or Zip Code, and re.... Anonymous MapPoint 2006/2009 Discussion 3 06-04-2002 04:42 PM


All times are GMT -5. The time now is 02:06 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0 RC2
MP2K Magazine
Visitor Map

Sharm El Sheikh Holiday
Enjoy the hot sun and fantastic beaches on your Sharm El Sheikh holiday! Check out the UlookUbook online offers...



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