View Single Post

  #1 (permalink)  
Old 08-29-2005
Yazzy Yazzy is offline
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;
Reply With Quote