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
Page 1 of 2 12 LastLast
Results 1 to 10 of 14

MapPoint 2002 - Reverse Address Lookup's in Delphi..

This is a discussion on MapPoint 2002 - Reverse Address Lookup's in Delphi.. within the MapPoint Desktop Discussion forums, part of the Map Forums category; I'm having loads of problems trying to reverse look-up addresses, i.e. the user provides just the Postcode or Street+Town I ...

  1. #1
    David is offline Junior Member Yellow Belt
    Join Date
    Aug 2002
    Posts
    13

    MapPoint 2002 - Reverse Address Lookup's in Delphi..

    I'm having loads of problems trying to reverse look-up addresses, i.e. the user provides just the Postcode or Street+Town I then want to fill in the missing values; say if the user provides just a postcode I want to be-able
    to extract the Street, Locality, Town, County etc.. from MapPoint.

    I've had a go using both Location.FindNearby and Map.ObjectsFromPoint; but when I try and access a StreetAddress object from within the results I get an exception error even if the original request already had a Street Name, Town, Postcode etc. :-(.

    I think I'm just chasing my own tail here im sure there is a problem with the OLE/ActiveX interface :-(

    Anybody got any ideas?

    Regards,

    David Luck.

  2. #2
    John Meyer's Avatar
    John Meyer is offline Senior Member Blue Belt
    Join Date
    Jul 2002
    Posts
    478
    Have you tried the ShowFindDialog method?

  3. #3
    David is offline Junior Member Yellow Belt
    Join Date
    Aug 2002
    Posts
    13
    I have not used the ShowFindDialog method but at a guess I would say that actually "displays" a dialog requiring user input, the problem is this is part of a Server system and the MapPoint objects are contained in a Thread so no direct user input is possible.

  4. #4
    John Meyer's Avatar
    John Meyer is offline Senior Member Blue Belt
    Join Date
    Jul 2002
    Posts
    478
    Ok, I'm confused. I think you would need to discribe what you are doing a little more or at least post the code that is not working.

    In the first post you said a user might only enter a postcode and you want to "extract the Street, Locality, Town, County etc" Do you have pushpins already on the map that you are trying to find the best match for?

  5. #5
    David is offline Junior Member Yellow Belt
    Join Date
    Aug 2002
    Posts
    13
    Ok here goes :)

    We develop a control system for transport companies, at present each client PC has a copy of MapInfo installed and all Mapping, routing and postcode look-ups are done locally. Trouble is this means the client machines need to be pretty well spec'ed to actually make the system usable.

    This is where MapPoint comes in, we have decided to opt for a Client/Server type Mapping system where the client systems (users) just post requests to a mapping server (very high-spec machine) which in-turn queries MapPoint for a Map, Route or address look-up, the server then returns an XML response to the client.

    I have written the server product in Delphi and it has been designed as a multi-threaded application, so the MapPoint objects are self contained in their own thread and there-fore are only accessed when a request is to be processed, this means the system is stand alone and it is not possible for any direct user input into the MapPoint components, also all MapPoint COM/ActiveX objects are created and accessed at code level so there is no visible representation of MapPoint on the server.

  6. #6
    John Meyer's Avatar
    John Meyer is offline Senior Member Blue Belt
    Join Date
    Jul 2002
    Posts
    478
    Can you post the sub/function where you try and access the streetaddress as you discribed so I can try a few things with it?

    "but when I try and access a StreetAddress object from within the results I get an exception error even if the original request already had a Street Name, Town, Postcode etc."

  7. #7
    David is offline Junior Member Yellow Belt
    Join Date
    Aug 2002
    Posts
    13
    This is'nt "exactly" what tried, but it was something along these lines:

    mpLocation is the location from which I want to find the nearest Street, lets say for example the postcode for mpLocation is 'RG6 3XA'.

    Note mpMap is a Public Object of TMap (MapPoint Map).

    Code:
    //mpLocation is the location we are trying to reverse look-up, the result/output
    //(TLocation) is a custom object containing address information: street, town etc.
    function TMapPointThd.FindNearestStreet(mpLocation : Location) : TLocation;
    var
      mpResults  : FindResults;
      iResult    : Integer;
      oleCount   : oleVariant;
      oleResult  : oleVariant;
    
    begin
    
      //Not sure exactly what this does but im told its nessessary??
      mpLocation.GoTo_;
    
      //Convert the given locaton to X and Y co-ord's on the map.
      mpResults := mpMap.ObjectsFromPoint(mpMap.LocationToX(mpLocation),mpMap.LocationToY(mpLocation));
    
      //Use an oleVariant object to store the number of results.
      oleCount := mpResults.Count;
    
      //do we have any results?
      if (oleCount > 0) then
      begin
        //loop through all the results.
        for iResult := 1 to oleCount do
        begin
          //Another ole variant is required to read the results so we convert the
          //integer iResults to an oleVariant type.
          oleResult := iResult;
    
          //Make sure the result is not nil.
          if &#40;mpResults.Item&#91;oleResult&#93; <> Nil&#41; then
          begin
            //Look up the street name..
            Result.Street &#58;= Location&#40;mpResults.Item&#91;oleResult&#93;&#41;.StreetAddress.Street;
          end;
        end;
      end;
    end;

  8. #8
    John Meyer's Avatar
    John Meyer is offline Senior Member Blue Belt
    Join Date
    Jul 2002
    Posts
    478
    David,

    There is NOT an easy way to do what you are trying to do (That I can see): ie just using a postcode and reterning the closest street.

    About the most I could get the StreetAddress property to do was return the City if that was the only thing I omitted when I used FindAddressResults to get my Location object..

    I think that when you tried to get a location object ("even when the original request already had a street name") the reason you got an error was Mappoint did not have enough info to get a match and returned Nothing. in other words when you tried to use the objLocStreetAddress.Street (or whatever) your objLoc was Nothing.

    FindNearby method results are limited to the currently visible PlaceCategory objects (Like Restaurants, Airports etc..) So that wouldn't work even if you have a good location object.

    Sorry I couldn't be of more help. If anyone else has an idea feel free to jump in!

  9. #9
    John Meyer's Avatar
    John Meyer is offline Senior Member Blue Belt
    Join Date
    Jul 2002
    Posts
    478
    Check out this article:

    Reverse Geocoding, Pt. III
    Walt Cygan, a frequent contributor of late, submits this solution for tackling reverse geocoding

    http://www.mp2kmag.com/articles.asp?ArticleID=50

    "I use the ObjectsFromPoint method repeatedly at slightly different locations to attempt to find an address. "

  10. #10
    Eric Frost's Avatar
    Eric Frost is offline Administrator Black Belt
    Join Date
    Jul 1992
    Posts
    5,094
    Blog Entries
    4
    As the Pt. III suggests, there were a couple articles before then.. http://www.mp2kmag.com/mappoint/disc...pic.asp?t=2966
    ~ Order MapPoint MapPoint 2013 Here and Get Free Access to the MapForums Downloads ~
    ~~
    ~ Upgrade to Get Access to the MapForums Downloads ~

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Getting address information of location object in delphi?
    By Sheridan in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 03-07-2003, 08:37 AM
  2. Open a map of a special address with Delphi
    By Rita P. in forum MapPoint Desktop Discussion
    Replies: 4
    Last Post: 02-10-2003, 05:02 PM
  3. Address Verifier with Delphi
    By yelmaci in forum MP2K Magazine Articles
    Replies: 4
    Last Post: 01-21-2003, 11:19 AM
  4. MapPoint reverse geocoding
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 01-03-2003, 09:13 AM
  5. Reverse Geocoding with MapPoint 2002
    By Anonymous in forum MP2K Magazine Articles
    Replies: 0
    Last Post: 09-25-2001, 11:48 PM

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