Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 3 of 3

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 Desktop 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 ...

  1. #1
    schuchhardp is offline 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;

  2. #2
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    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;

  3. #3
    schuchhardp is offline 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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Having problems retrieving city name from Zip Code
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 11-18-2004, 02:22 PM
  2. Help: convert VB code to Delphi!
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 10-06-2004, 01:02 PM
  3. Retrieving a Territory name from a provided Lat & Long
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 03-01-2004, 01:41 AM
  4. Delphi OleContainer problems
    By pafreshney in forum MapPoint Desktop Discussion
    Replies: 6
    Last Post: 09-15-2003, 01:50 PM
  5. Dutch zip codes
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 04-08-2003, 05:52 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83