MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Getting a Postal Sector from Latitude and Longitude

This is a discussion on Getting a Postal Sector from Latitude and Longitude within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hi I have ONLY the Longitude and Latitude of a place and I need a way to find the PostalCode ...


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 08-29-2005
Junior Member
Yellow Belt
 
Join Date: Dec 2004
Posts: 25
Getting a Postal Sector from Latitude and Longitude

Hi

I have ONLY the Longitude and Latitude of a place and I need a way to find the PostalCode for the place. No dataset avaiable

For example Lat = 52.0185 Long = -0.2654
Set objLoc = objmap.GetLocation(Latitude, Longitude)
objLoc.GoTo

Set objPin = objmap.AddPushpin(objLoc)
objPin.Select

I get the pushpin at the correct place on the map. But when I use the

Set objResults = objmap.ObjectsFromPoint(objmap.LocationToX(objLocA ), objmap.LocationToY(objLocA))

For Each objResult In objResults
MsgBox objResult.Name
Next

I get incorrect results i.e 'Luton', Sandy Roundabout etc when the correct results should be Chase Hill Road, Arlesey, SG15 6.

When I fire a MouseDown event around the pushpin I do get House Number, Chase Hill Road, Arlesey, SG15 6.

i would like to know how I can capture this without firing MouseDown events.

Thanks in advance

PS
I have also tried the following method and I get errors of 'Type Mismatch' Or 'Object does not support this method etc

Map map = MP.ActiveMap;
Location loc = map.GetLocation(lat, lon, 1);
FindResults nearby = loc.FindNearby(1);
foreach (object o in nearby) {
loc = o as Location;
if (loc != null && loc.StreetAddress != null && loc.StreetAddress.PostalCode != "") {
return loc.StreetAddress.PostalCode;
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 08-30-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Hi,

I just tryed this exact code in a menu item and it gives me a post code:

Code:
        private void postcodefromlatlongToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Map map = MP.ActiveMap;
            Location loc = map.GetLocation(51, 4, 1);
            FindResults nearby = loc.FindNearby(5);
            foreach (object o in nearby) {
                loc = o as Location;
                if (loc != null && loc.StreetAddress != null && loc.StreetAddress.PostalCode != "")
                    Console.WriteLine(loc.StreetAddress.PostalCode);
            }
        }
FindNearby does not find always a postcode. This is because it is designed to search for points of interest which does not nececary have a postal code. Another way is scan the map in code with a vector until you have a postal code.
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 08-30-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Hi,

I tryed your original code as whell and it works. Only your coordinates are not right, it has to be: loc = map.GetLocation(52.0185, -0.2653, 1);

Longitude -0.2654 is not on a road, so map cannot give you information. You have to be at least on a known object.
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
latitude, longitude, postal, sector


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 get latitude and longitude ma2005pp MapPoint 2006/2009 Discussion 3 09-28-2005 02:57 AM
Latitude and Longitude virgilar MapPoint 2006/2009 Discussion 1 03-21-2005 02:01 PM
Latitude and Longitude Anonymous MapPoint 2006/2009 Discussion 1 11-25-2003 01:52 PM
NMEA latitude/longitude and mappoint latitude/longitude muurman MapPoint 2006/2009 Discussion 3 11-22-2003 05:42 AM
VB6 - Latitude and longitude of a pushpin ??? Vincent BENNER MapPoint 2006/2009 Discussion 1 11-12-2002 07:03 AM


All times are GMT -5. The time now is 09:01 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 55