MapPoint Forums

MapForums

Community of MapPoint and Virtual Earth Users and Developers




Is it possible to retrieve county names from the z....

This is a discussion on Is it possible to retrieve county names from the z.... within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Is it possible to retrieve county names from the zip code/ or location object with a com addin? Thanks, Kevin...


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 12-18-2001
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Is it possible to retrieve county names from the zip code/ or location object with a com addin?
Thanks, Kevin
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-18-2001
Senior Member
Green Belt
 
Join Date: Aug 2002
Posts: 124
No. The county information is not exposed anywhere in the data model as a property.


- Walt Cygan


Update: 12/23/2001 - The following message posted on the microsoft.public.mappoint newsgroup may help you.


Ken,



On Sat, 22 Dec 2001 07:35:03 -0600, "Ken Levy"

<kenlevy_deleteSpAm@home.com> wrote:



>Gilles:

>

>Thanks for the post. I checked out the reference you gave and found several

>good leads. One of the best, I think, was a dataset from the National

>Weather Service which contains time zone for each county in the US. Is

>there a way of getting the county name for a particular MP location object?



Try this (put it into a VB module):



Option Explicit



Public Function CountyFromLocation(oMap As MapPoint.Map, _

oOrgLoc As MapPoint.Location) As String

Dim oResults As MapPoint.FindResults



' Search for info

Set oResults = oMap.ObjectsFromPoint( _

oMap.LocationToX(oOrgLoc), _

oMap.LocationToY(oOrgLoc))



' define a generic object to iterate over FindResults

Dim oObj As Object



Dim oLoc As MapPoint.Location



CountyFromLocation = ""



' Loop over collection

For Each oObj In oResults

' Find out object type

If TypeOf oObj Is MapPoint.Location Then

Set oLoc = oObj ' Use Location object



' Got a county ?

If oLoc.Type = geoShowByRegion2 Then

CountyFromLocation = oLoc.Name

Exit Function

End If

End If

Next oObj



End Function


CountyFromLocation will return the name of the corresponding county,
given a map object, and a location. It will return an empty string
("") if no county was found.


Put the following into the code part of a VB form to test it:


Option Explicit

Dim oMpApp As MapPoint.Application

Dim WithEvents oMap As MapPoint.Map



Private Sub Form_Load()

Set oMpApp = GetObject(, "MapPoint.Application")

Set oMap = oMpApp.ActiveMap

End Sub



Private Sub oMap_BeforeClick(ByVal Button As Long, ByVal Shift As

Long, ByVal X As Long, ByVal Y As Long, Cancel As Boolean)

Dim oLoc As MapPoint.Location



Set oLoc = oMap.XYToLocation(X, Y)



Dim strCounty As String



strCounty = CountyFromLocation(oMap, oLoc)

If strCounty = "" Then strCounty = "No county found"

List1.AddItem strCounty

End Sub


The form should have a listbox List1 - each time you click in the map
(MapPoint should be running before you launch the program), it will
display its county guess in the listbox.



Regards,

Gilles [MVP].


P.S.: You may also want to check out
<http://www.mp2kmag.com/articles.asp?ArticleID=45> in this context -
this was used as the basis for the above.


--- Thanks, Gilles
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
county, names, retrieve


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
Retrieve Lat/Lon of a ShaddedCircle rorgmanche MapPoint 2006/2009 Discussion 2 09-09-2005 07:38 AM
Showing only county lines and names? Anonymous MapPoint 2006/2009 Discussion 2 02-10-2005 02:13 PM
Retrieve street names within shape Dazzer MapPoint 2006/2009 Discussion 0 12-19-2003 04:52 AM
Adding county names and exporting Anonymous MapPoint 2006/2009 Discussion 0 11-05-2003 05:00 PM
Also, can I delete the state names and city names .... Anonymous MapPoint 2006/2009 Discussion 1 08-29-2000 12:57 PM


All times are GMT -5. The time now is 12:13 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

Thassos Holidays
Visit an unspoilt and beautiful Greek island with Thassos holidays available through UlookUbook.



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