Community of VE/MapPoint Users and Developers
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 ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Getting a Postal Sector from Latitude and Longitude 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; |
| |||
|
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);
}
}
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
|
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.
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
![]() |
| Tags |
| latitude, longitude, postal, sector |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| 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 |