MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Location & FindResults not always returning City/State/etc.?

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 ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 4 Days Ago
OOT OOT is offline
Junior Member
Yellow Belt
 
Join Date: Dec 2006
Posts: 14
Thumbs up [ Resolved ] Location & FindResults not always returning City/State/etc.?

OK. I hope that I'm just doing something wrong. I've got some code for getting the center point of the map (.width - 6 / 2, .height - 6 / 2). That returns a MapPoint.Location object.

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
Sometimes I run this and I get the information like I should but then sometimes I run it and everything is empty. When I debug and step through the code the StreetAddress object is either empty or contains empty strings for City, Region (State) and PostalCode.

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!
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 4 Days Ago
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 1,952
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.
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 4 Days Ago
OOT OOT is offline
Junior Member
Yellow Belt
 
Join Date: Dec 2006
Posts: 14
Talking Re: Location & FindResults not always returning City/State/etc.?

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.
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 4 Days Ago
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 1,952
Re: Location & FindResults not always returning City/State/etc.?

Hi,

Glad it works That's what I often do in some occations where it is just necessary to get a location nearby some point.
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


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/location-findresults-not-always-returning-city-state-etc-7661.html

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

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
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


All times are GMT -5. The time now is 08:49 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5
MP2K Magazine
Visitor Map

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!


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