Community of VE/MapPoint Users and Developers
This is a discussion on MapPoint 2002 - Reverse Address Lookup's in Delphi.. within the MapPoint 2006/2009 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 ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| MapPoint 2002 - Reverse Address Lookup's in Delphi.. 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. |
| ||||
|
Have you tried the ShowFindDialog method?
__________________ John http://www.support-pc.com Order MapPoint 2006 Here https://secure.mp2kmag.com/?refer=support-PC |
| |||
|
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. |
| ||||
|
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?
__________________ John http://www.support-pc.com Order MapPoint 2006 Here https://secure.mp2kmag.com/?refer=support-PC |
| |||
|
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. |
| ||||
|
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."
__________________ John http://www.support-pc.com Order MapPoint 2006 Here https://secure.mp2kmag.com/?refer=support-PC |
| |||
|
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 (mpResults.Item[oleResult] <> Nil) then
begin
//Look up the street name..
Result.Street := Location(mpResults.Item[oleResult]).StreetAddress.Street;
end;
end;
end;
end;
|
| ||||
|
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!
__________________ John http://www.support-pc.com Order MapPoint 2006 Here https://secure.mp2kmag.com/?refer=support-PC |
| ||||
|
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. "
__________________ John http://www.support-pc.com Order MapPoint 2006 Here https://secure.mp2kmag.com/?refer=support-PC |
| ||||
|
As the Pt. III suggests, there were a couple articles before then.. http://www.mp2kmag.com/mappoint/disc...pic.asp?t=2966
__________________ |
![]() |
| Tags |
| address, delphi, lookup, mappoint 2002, reverse |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Getting address information of location object in delphi? | Sheridan | MapPoint 2006/2009 Discussion | 1 | 03-07-2003 09:37 AM |
| Open a map of a special address with Delphi | Rita P. | MapPoint 2006/2009 Discussion | 4 | 02-10-2003 06:02 PM |
| Address Verifier with Delphi | yelmaci | MP2K Magazine Articles | 4 | 01-21-2003 12:19 PM |
| MapPoint reverse geocoding | Anonymous | MapPoint 2006/2009 Discussion | 2 | 01-03-2003 10:13 AM |
| Reverse Geocoding with MapPoint 2002 | Anonymous | MP2K Magazine Articles | 0 | 09-26-2001 12:48 AM |