Interface IGeocodingService

All Known Implementing Classes:
OpenStreetMapGeoCoder

public interface IGeocodingService
Interface defining the geocoding service used within the application. It provides methods to convert addresses into geographic coordinates, generate address suggestions for user input, and perform reverse geocoding to obtain readable addresses from latitude and longitude values.
  • Method Summary

    Modifier and Type
    Method
    Description
    double[]
    Converts an address string into geographic coordinates.
    Returns address suggestions based on a partial search query.
    reverseGeocode(double lat, double lon)
    Converts latitude and longitude coordinates into a human-readable address.
  • Method Details

    • geocodeAddress

      double[] geocodeAddress(String address) throws Exception
      Converts an address string into geographic coordinates.
      Parameters:
      address - the address string to geocode
      Returns:
      a double array of length 2 where index 0 is latitude and index 1 is longitude
      Throws:
      Exception - if the address cannot be found or the request fails
    • getAddressSuggestions

      List<String> getAddressSuggestions(String query) throws Exception
      Returns address suggestions based on a partial search query.
      Parameters:
      query - the partial address string typed by the user
      Returns:
      a list of matching address strings, or an empty list if none found
      Throws:
      Exception - if the request fails
    • reverseGeocode

      String reverseGeocode(double lat, double lon) throws Exception
      Converts latitude and longitude coordinates into a human-readable address.
      Parameters:
      lat - the latitude coordinate to reverse geocode
      lon - the longitude coordinate to reverse geocode
      Returns:
      a readable address string, or a formatted coordinate string if lookup fails
      Throws:
      Exception - if the request fails