How to determine whether a street or address exists near geographic coordinates?

505 Views Asked by At

My program calculates new coordinates in WGS84 for google (longitude and latitude). How can you verify whether under these coordinates is a street or an address.

1

There are 1 best solutions below

4
On

This functionality is provided by the TGeocoder class - documentation can be found here :

Class : TGeocoder

Used for handling geocoding and reverse geocoding.

Geocoding is the process of transforming geographic data like address, zip codes into geographic coordinates. Reverse geocoding is the process for transforming geographical coordinates into other geographical data, such as address. The Initialize procedure must be used before using TGeocoder for the first time through the Current property. The Supported function determines whether the geocoding can be realized. Authorized determines whether the application is authorized to use the service.

The method you likely want : TGeocoder.GeocodeReverse

Requests the address matching the specified geographic coordinates.

To create an instance of the TGeocoder class specific to your platform/device, you use the .Current class property as described in the documentation.

// ... in your class
private       
    FGeocoder: TGeocoder;
    procedure OnGeocodeReverseEvent(const Address: TCivicAddress);

and then

// Setup an instance of TGeocoder
if not Assigned(FGeocoder) then
begin
  if Assigned(TGeocoder.Current) then
    FGeocoder := TGeocoder.Current.Create;
  if Assigned(FGeocoder) then
    FGeocoder.OnGeocodeReverse := OnGeocodeReverseEvent;
end;