MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




ActiveX MapPointControl: How to find county from City, State

This is a discussion on ActiveX MapPointControl: How to find county from City, State within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; I'm using the MapPoint control in an Access application. I would like to write a program to get the county ...


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

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-31-2006
Junior Member
White Belt
 
Join Date: Aug 2005
Posts: 8
Send a message via MSN to UncleJaz
ActiveX MapPointControl: How to find county from City, State

I'm using the MapPoint control in an Access application.

I would like to write a program to get the county for each city and state in a table of store locations.

The map I am opening with my control also has many territories defined which are composed of groupings of counties. I'm really trying to get the territory name for each city/state in my retail outlet table.

My original approach was to derive the county that a city was in and then cross reference with my territory/county table to derive the territory, but it would be more direct just to derive the territory based on the city/state of a location.

Has anyone ever done this or have a suggestion?

Thanks in advance
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 04-01-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,055
Hi,

You an make a Location object based on the coordiantes.
A Location object has a StreetAddress property. This has a City and Country property that you can use from VBA.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 04-02-2006
Junior Member
White Belt
 
Join Date: Aug 2005
Posts: 8
Send a message via MSN to UncleJaz
I'm looking for the county a city is in...

Thanks Wilfred, your reply about the location object having a streetaddress was helpful as I scrape my knuckles trying to learn this stuff. However, I'm looking for the County instead of countRy.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 04-04-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,055
Hi,

Euh can you please explain to me what a County is ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 04-04-2006
Junior Member
White Belt
 
Join Date: Aug 2005
Posts: 8
Send a message via MSN to UncleJaz
County definition

Counties are subdivisions of most states (US). All states have subdivisions but in a few they are called something else.

Mappoint considers all state subdivisions in US as counties (geoShowDataByRegion2). In Europe there are also counties and/or provinces.

My territories are defined by groups of counties and that's why I'm tyring to find the county that a given city is located in.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 04-04-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,055
Hi,

Thanks for explaining, we have provinces here so I understeand now. Nice word county But I dont know sorry. I hope someone else drops in here with some advice.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7 (permalink)  
Old 04-05-2006
Junior Member
White Belt
 
Join Date: Aug 2005
Posts: 8
Send a message via MSN to UncleJaz
I found a way to do this...

I found a way to find the county for a given city and state. I just wanted to follow up with this thread.

If anyone wants to know how I got it done, email me.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8 (permalink)  
Old 04-05-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,055
Hi,

yes please. How ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9 (permalink)  
Old 04-05-2006
Junior Member
White Belt
 
Join Date: Aug 2005
Posts: 8
Send a message via MSN to UncleJaz
Finding county for given city/state

Here's the approach I used to find the county of a city in pseudocode:

Sub Procedure GetCountyForCity(<strCity>, <strState>) as String
1. Get map object (active map)...objMap
2. Declare and set a location object:
>objLoc = objMap.FindResults(<strCity> & ", " & <strState>).Item(1)
3. Go to and select the location:
>objLoc.GoTo
>objLoc.Select
4. Declare and set a Results object:
>objRes = objMap.ObjectsFromPoint(objMap.LocationToX(objLoc) , objMap.LocationToY(objLoc))
5. Declare a set a boolean county found flag and temp county name variable
>bCountyFound = False
>strCounty = ""
6. Step through the results and find the object with type = 17 (geoShowDataByRegion2 for US counties)
>For i = 2 To objRes.Count 'index of 1 has no type and generates error
>>>If objRes.Item(i).Type = 17 Then
>>>>>>strCounty = objRes.Item(i).Name 'County found!
>>>>>>bCountyFound = True
>>>>>>Exit for
>>>End If
7. Return the results
>GetCountyForCity = strCounty
End Sub

In the calling procedure, you can test for "" county to see if you got one.

Specific syntax of course dependent on the language you'll be using.
Hope this is clear...let me know if you have questions.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10 (permalink)  
Old 04-05-2006
Junior Member
White Belt
 
Join Date: Aug 2005
Posts: 8
Send a message via MSN to UncleJaz
Oops!

In the pseudocode I just posted, the bCountyFound flag is not really needed. It was left over from earlier effort and I forgot to remove it.
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


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
How do you find the territory for a given city and state UncleJaz MapPoint 2006/2009 Discussion 0 04-05-2006 10:50 AM
Lat Long for County and State Anonymous MapPoint 2006/2009 Discussion 1 01-24-2005 06:20 PM
find city name & state name on mouse move event Atul22 MapPoint 2006/2009 Discussion 2 10-15-2004 04:28 AM
Validating City/State Names jbendiner MapPoint 2006/2009 Discussion 2 08-06-2004 02:33 PM
How do I map county data? Do I put state and count.... Anonymous MapPoint 2006/2009 Discussion 1 07-08-1999 06:16 AM


All times are GMT -5. The time now is 12:54 AM.


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

Orlando Flights
Holidays in Orlando are fantastic for families. There are a massive range of spectacular theme parks. Let Holiday Hypermarket book you great value Orlando flights and hotels.

City Break Europe
Take a city break in Europe. Travel Counsellors can help plan and book your European city break.

Cheap Flight Canada
Making a cheap flight to Canada can become a reality when you book online with dealchecker.co.uk. Our simple search allows you to see for yourself who is the cheapest.

Holidays to Cuba
For the best offers on holidays to Cuba, visit The Holiday Place today. Find a deal to suit you and your budget online!

Spain
Spain is such a diverse country that it has something to offer most holidaymakers. Finding delicious cuisine is no challenge and the shopping ranges from designer boutiques to unknown flea markets. Spain has much to offer.

Travel
Before making a choice regarding travel, check out the amazing variety of options on Travel.co.uk.

Cheap Holidays to Lanzarote
Visit the Canary Islands, even if you're cash strapped! View cheap holidays to Lanzarote at On The Beach!


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