Community of MapPoint and Virtual Earth Users and Developers
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 ...
| |||||||
| Today's Posts | Twitter Feed | Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Problems with Dutch ZIP codes (bug?) (Delphi code provided) 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; |
| |||
| 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; |
| |||
|
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 |
![]() |
| 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 | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Having problems retrieving city name from Zip Code | Anonymous | MapPoint 2006/2009 Discussion | 0 | 11-18-2004 02:22 PM |
| Help: convert VB code to Delphi! | Anonymous | MapPoint 2006/2009 Discussion | 3 | 10-06-2004 01:02 PM |
| Retrieving a Territory name from a provided Lat & Long | Anonymous | MapPoint 2006/2009 Discussion | 1 | 03-01-2004 01:41 AM |
| Delphi OleContainer problems | pafreshney | MapPoint 2006/2009 Discussion | 6 | 09-15-2003 01:50 PM |
| Dutch zip codes | Anonymous | MapPoint 2006/2009 Discussion | 2 | 04-08-2003 05:52 AM |
Thassos Holidays
Visit an unspoilt and beautiful Greek island with Thassos holidays available through UlookUbook.