Thanks for feedback. It will benefit others
This is a discussion on ActiveX MapPointControl: How to find county from City, State within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi, Thanks for feedback. It will benefit others...
I've been working on fetching the county for two days, but couldn't figure out how to access that geoFieldRegion2.
Your code has saved me a lot of work.
Hi, Jaz! I attempted to use the pseudocode you wrote here. Unfortunately, depending upon which city/state combination I use, the county winds up in a different sub of the result array. Sometimes, the county is in .Item(9). Sometimes, it's .Item(4).
Does anyone have any explanation as to why this is happening?
Here's a snippet that I derived from Jaz's pcode:
PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim cou AsString
Dim typ AsInteger
Dim ptr AsInteger
Dim oRes As MapPoint.FindResults
Dim myLoc As MapPoint.Location
Dim col AsNew Collection
ForEach myLoc In oFindresults
oRes = oMap.ObjectsFromPoint(oMap.LocationToX(myLoc), oMap.LocationToY(myLoc))
For ptr = 1 To oRes.Count
If oRes.Item(ptr).type = 17 Then
typ = oRes.Item(ptr).type
cou = oRes.Item(ptr).name
I use this code to find intersections where auto accidents happen by "on road" and "at road", then build a collection of all of the locations that are in the county where I know the accident happened. Our data entry people then skip from location to location until they get to the right one (within the right county), then use a little mouse routine to record the accident's latitude and longitude.
I tried to get rid of most of the junk that wouldn't matter to you.
Again, thanks to Jaz whose code saved my sanity.
There are currently 1 users browsing this thread. (0 members and 1 guests)