Community of VE/MapPoint Users and Developers
This is a discussion on Location & FindResults not always returning City/State/etc.? within the MapPoint 2006 Discussion forums, part of the Map Forums category; OK. I hope that I'm just doing something wrong. I've got some code for getting the center point ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| I take that object and I just want to get some "general" location information (from the StreetAddress field). I don't care about the Address information but I do want to know the city, state and postal code for whatever location is the current centerpoint of the map. Here is what I've got and I can't figure out what I'm doing wrong. Code: ''''oMPLoc is a MapPoint.Location set to these coordinates:
''''lat:33.3720721397549 lng: -83.7399965710938
oMPLoc.GoTo()
Dim addressResults As MapPoint.FindResults = _
oMap.ObjectsFromPoint(oMap.LocationToX(oMPLoc), _
oMap.LocationToY(oMPLoc))
Dim o As Object
For Each o In addressResults
If TypeOf o Is MapPoint.Location Then
Dim streetLoc As MapPoint.Location = o
If streetLoc.StreetAddress IsNot Nothing Then
txtCity.Text = streetLoc.StreetAddress.City
txtPostal.Text = streetLoc.StreetAddress.PostalCode
txtState.Text = streetLoc.StreetAddress.Region
End If
End If
Next Assuming I have a location based on valid Latitude and Longitude coordinates, is there a better way to get the City, State and PostalCode information? Can anyone see what I'm doing wrong in the code above (VB.NET)? Any and all help is greatly appreciated. And please speak as plainly as possible as I'm quite the newbie Thank you in advance for any and all help. Last edited by OOT; 4 Days Ago at 02:13 PM. Reason: Answered! |
| |||
| Re: Location & FindResults not always returning City/State/etc.?
Hi, sometimes there is no result you say, but indeed possible there is just no valid location in the center of the map. you can increase altitude to find one, increasing altitude set the dilusion of precision higher so chance is better there is a valid location.
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
|
Wow. That was fast and it fixed the problem. So I've written it as a Function and if it returns as Nothing then I re-run at higher Altitude ... works like a charm! Thank you very much for that. |
| |||
| Re: Location & FindResults not always returning City/State/etc.?
Hi, Glad it works
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
![]() |
| ||||
| Posted By | For | Type | Date | |
| The Magazine for MapPoint - MP2K Magazine | This thread | Refback | 4 Days Ago 05:52 PM | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Return County for City-State Pairs | FrankB | MapPoint 2006 Discussion | 0 | 09-06-2007 06:31 PM |
| How do you find the territory for a given city and state | UncleJaz | MapPoint 2006 Discussion | 0 | 04-05-2006 10:50 AM |
| Removing City and State Names from a data map | klkrueg | MapPoint 2006 Discussion | 1 | 06-07-2005 05:59 AM |
| Validating City/State Names | jbendiner | MapPoint 2006 Discussion | 2 | 08-06-2004 02:33 PM |
| City, State and Country info for a loc found using lat/lng | lavend | MapPoint 2006 Discussion | 0 | 04-28-2004 02:17 PM |
Bulgaria Ski Holidays
First time skier? Looking for something a little different? Bulgaria Ski holidays could be the perfect remedy to your winter blues. Bulgaria prices are great value.
Flights to Portugal
Find and book flights to Portugal. Travel Counsellors can help with travel to Portugal including flights and accommodation.
Cheap Holidays to Cuba
Cheap holidays to Cuba are a reality when you book with dealchecker.co.uk. We search leading UK Travel agents and tour operators to bring you some great deals.
Mauritius Holidays
Mauritis holidays are a sun drenched, sense tingling experience of a lifetime. You will find bargain deals on many holidays with us!
Morocco
Gain insight on your holiday destination with the ULookUBook travel guides. Find out about Morocco and its customs online. Make an informed decision when you make a booking.
Cheap Holidays
Looking for holidays that are cheap, but still what you want? Visit Travel.co.uk.
Cheap Holidays to Cyprus
Enjoy island nightlife at its best! Book cheap holidays to Cyprus at On The Beach!