Hi,
I think I've seen some other posts about this subject, but I will also give this a try:
I try to obtain the ZIP codes for a given set of Locations. I use ObjectsFromPoint to get a list of streets and then try to get the postalCode for one of those streets. This works for locations that are on streets in countries such as France, Germany and Spain. It doesn't work for the Netherlands: the value for streetAddress.postalCode there is always an empty string.
My questions are:
a) Is the way I try to obtain the postalCode the best one and do any alternatives exist?
b) Does anyone know the reason why the Netherlands are different from other European countries? Is this a bug, or does Microsoft just not provide this functionality for this country?
Thanks for any help you can give me with this,
Pascal
I have provided a sample of Delphi code:
function getPostalData(latitude: Extended; longitude: Extended): String;
var
StreetResults: FindResults;
address: StreetAddress;
myLoc: Location;
i: Integer;
j: OLEVariant;
size: Integer;
temp: IDispatch;
begin
result:='';
myLoc:=myMap.GetLocation(latitude, longitude, 1);
myLoc.GoTo_;
StreetResults:= MyMap.ObjectsFromPoint(MyMap.LocationToX(myLoc), MyMap.LocationToY(myLoc));
size:=StreetResults.count;
//we loop through the resultset and look at all streets
//result:='s='+intToStr(size);
for i:=1 to size do begin
j:=i;
temp:=StreetResults.Get_Item(j);
if(temp.queryInterface(Location, myLoc)=0) then //its a location Object
begin
address:=myLoc.StreetAddress;
if (address<>nil) then begin
if(length(address.postalCode)>0) then
result:=result+ '_'+ address.postalCode
else
result:=result+'_length was 0';
end;
end;
//else result:=result+'_X';
end;
end;