MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




How to retrieve complete address from longitudes and latitud

This is a discussion on How to retrieve complete address from longitudes and latitud within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hi All, I'm working on a C# desktop application with MapPoint2004. I'm using ActiveX control on Europe's map. The problem ...


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

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-04-2006
Junior Member
Yellow Belt
 
Join Date: Feb 2006
Posts: 18
Send a message via MSN to Learner Send a message via Yahoo to Learner
How to retrieve complete address from longitudes and latitud

Hi All,
I'm working on a C# desktop application with MapPoint2004. I'm using ActiveX control on Europe's map. The problem is that I've the value of Longitude and Latitude for a customer and I've to retrieve country, city, state/county, street address from it. Please guide me how can I accomplish this.
Thanks in advance
Regards
__________________
Learn from cradle to the grave
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 03-05-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Hi,

Something like this should help you start:

Code:
            Location loc = mp.ActiveMap.GetLocation(lat, lon, alt);
            loc.GoTo();

            FindResults streetResults = map.ObjectsFromPoint(map.LocationToX(loc), map.LocationToY(loc));

            foreach (object o in streetResults) {
                Location streetLoc = o as Location;
                if(streetLoc != null && streetLoc.StreetAddress != null) {
                    // ...
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 03-05-2006
Junior Member
Yellow Belt
 
Join Date: Feb 2006
Posts: 18
Send a message via MSN to Learner Send a message via Yahoo to Learner
Retrieving complete address from latitude and longitude...

Hi Wilfried,
Thanks for your consideration and reply. Would you be kind enough to suggest how to extract country, city, county/state info from street address that I'll be able to retrieve through the code snippet that you wrote.
Thanks in advance
Regards
__________________
Learn from cradle to the grave
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 03-06-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Hi,

The StreetAddress contains all the propreties you need, eg:

Code:
                if(streetLoc != null && streetLoc.StreetAddress != null) {
                    Console.WriteLine("value    " + streetLoc.StreetAddress.Value);
                    Console.WriteLine("street   " + streetLoc.StreetAddress.Street);
                    Console.WriteLine("postcode " + streetLoc.StreetAddress.PostalCode);
                    Console.WriteLine("city     " + streetLoc.StreetAddress.City);
                    Console.WriteLine("country  " + streetLoc.StreetAddress.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
  #5 (permalink)  
Old 03-07-2006
Junior Member
Yellow Belt
 
Join Date: Feb 2006
Posts: 18
Send a message via MSN to Learner Send a message via Yahoo to Learner
It did work the problem....

Hi,
Thank you very much wilfried for helping me to solve the problem. It really did work. Hope i'll be able to benefit from your expertise in future also.
Regards
__________________
Learn from cradle to the grave
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 09-19-2006
Junior Member
White Belt
 
Join Date: Sep 2006
Posts: 1
I'm trying to do the same, but when a lat lon position isn't right on a street it doesn't have any streetadress information. I tried the
findNearby() but that finds places of intrest in the neighbourhood. I just want to know the streetadress information nearest to my lat lon position. Do you have any clue how i can do that?

Thanks
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 09-19-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Hi,

Try to go higher altitude, this lowers the resolution and chance is higher you are on a road (but also on multiple roads).

Another approach is to check where the nearest road is from the point of your position. Will work always, but take more time, specially if position is far from a digitized road.

For the latter you can find an article over here. Please do a search on "snap to road".
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 01-03-2007
Member
Green Belt
 
Join Date: Nov 2006
Posts: 87
Re: How to retrieve complete address from longitudes and latitud

Hi Wilfried,

Suppose I've a pushpin somewhere on the map and from the pushpin I retrieve the Location object. Is that enough to parse one streetadres from it, or do I have to add some codes to get a nearest adress? Because I've seen your example where you used altitude = 1. I don't know if that is necessary if I've already a pushpin from where I get the Location object.

I ask this because I've a set of hundreds of pushpins, and when I select a particular pushpin, I want to see the associated adress. So I guess there is normally one adress, because my pushpins will alway be on the road and not in a parc, a playground or something else.

So what do you think, with your huge MP experience

Also I like to know how to check wether an object is type of Pushpin, Location, Shape etc....
The reason I ask this, is in the eventmethod: object.SelectionChange(NewSelection, OldSelection)
NewSelection can be Direction, Location, Pushpin, Shape, or Waypoint object on the map.
So that's why would like to know how to know which objecttype I deal with.
I hope somebody reply on this soon, thnx anyway

Last edited by VC_Man; 01-03-2007 at 07:49 AM.
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 01-03-2007
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Re: How to retrieve complete address from longitudes and latitud

Hi,

You have indeed a Pushpin object that has a Location property. But this Location object does not have a StreetAddress object, it will be null. So even for your existing pushpins that are on a road you have to find streetinformation separate.

To know what kind of a type an object is you can do 2 things that comes into mind. This is C#, I dont know your langiage but it will be similar syntax:

Code:
  if (newSelection is Shape)
      // It is a Shape

  Shape s = newSelection as Shape;
  if (s != null)
      // It is a Shape
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 01-03-2007
Member
Green Belt
 
Join Date: Nov 2006
Posts: 87
Re: How to retrieve complete address from longitudes and latitud

Hi Wilfried,

Thnx 4 ur reply, so than I've to make another locationobject out of the latiude-longitude of the locationobject that I retrieved from a pushpinboject including the altitude paramter, right?

Concerning the NewSelection/OldSelection, I'll create a new thread for it on the forum.
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

Tags
address, complete, latitud, longitudes, retrieve


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 to retrieve nearest city from longitudes and latitud fsarraj MapPoint 2006/2009 Discussion 3 03-08-2006 01:22 PM
Is it possible to calculate latitud/longitud through address Learner MapPoint 2006/2009 Discussion 1 03-08-2006 01:15 PM
Complete adress, when using ShowFindDialog? Jarun MapPoint 2006/2009 Discussion 3 04-11-2005 02:31 PM
MapPoint can't import near-zero longitudes? random MapPoint 2006/2009 Discussion 6 08-25-2004 10:03 AM
Complete data connectivity Anonymous MapPoint 2006/2009 Discussion 0 07-01-2003 03:57 AM


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


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


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 52 53 54