Community of VE/MapPoint Users and Developers
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 ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| ActiveX MapPointControl: How to find county from City, State 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 |
| |||
|
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.
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
| 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. |
| |||
|
Hi, Euh can you please explain to me what a County is ?
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
| 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. |
| |||
|
Hi, Thanks for explaining, we have provinces here so I understeand now. Nice word county
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
|
Hi, yes please. How ?
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
| 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. |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| 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 |
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!