MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Problems with Dutch ZIP codes (bug?) (Delphi code provided)

This is a discussion on Problems with Dutch ZIP codes (bug?) (Delphi code provided) within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hi, I think I've seen some other posts about this subject, but I will also give this a try: I ...


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 11-12-2002
Junior Member
White Belt
 
Join Date: Nov 2002
Posts: 10
Problems with Dutch ZIP codes (bug?) (Delphi code provided)

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;
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 11-27-2002
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
reaction

Hi,

This solution works. The several fields you can retrieve are a bit strange. For the netherlands only the numeral part is given back by Mappoint.

success!
Jan Vieveen.



procedure Tformmain.Button5Click(Sender: TObject);
var mpMap: _Map;
x1,y1: real;
objloc1,objloc2: Location;
objres : findresults;
j,k : integer;
i : OleVariant;
temp: IDispatch;
address:StreetAddress;
wstr: widestring;

begin
mpApplication.Visible:=TRUE;
mpMap:=mpAPplication.ActiveMap;

x1:=52.154;
y1:=5.0;
objloc1:=mpMap.GetLocation(x1,y1,1);
objloc1.GoTo_();
objres:=objloc1.FindNearby(10);
j:=objres.Count;
if j>1 then
begin
i:=1;
temp:=objres.item[i];
if (temp.queryInterface(Location, objloc2)=0) then //its a location Object
begin
address:=objloc2.StreetAddress;
address:=objloc2.Get_StreetAddress(); // works as well
wstr:=address.City;
wstr:=address.Get_City();
wstr:=address.Get_Street();
wstr:=address.Get_PostalCode();
wstr:=address.Get_OtherCity();
wstr:=address.Value;
end;
end;

end;
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 11-28-2002
Junior Member
White Belt
 
Join Date: Nov 2002
Posts: 10
Sorry Jan, but I can't get it to werk. My results are just empty. Maybe you have a different version of MP? I use 2002.

It's also easy to check this problem by just clicking on the map. When selecting a street in Amsterdam, you are usually provided a streetname and housenumber. Streets in Berlin, Antwerp and Paris will also provide the postal code.

I wonder if this is a bug and if it will be fixed in the next version of MP.

Pascal
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
bug, code, codes, delphi, dutch, problems, provided, zip


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
Having problems retrieving city name from Zip Code Anonymous MapPoint 2006/2009 Discussion 0 11-18-2004 03:22 PM
Help: convert VB code to Delphi! Anonymous MapPoint 2006/2009 Discussion 3 10-06-2004 02:02 PM
Retrieving a Territory name from a provided Lat & Long Anonymous MapPoint 2006/2009 Discussion 1 03-01-2004 02:41 AM
Delphi OleContainer problems pafreshney MapPoint 2006/2009 Discussion 6 09-15-2003 02:50 PM
Dutch zip codes Anonymous MapPoint 2006/2009 Discussion 2 04-08-2003 06:52 AM


All times are GMT -5. The time now is 11:28 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