Class NominatimGeocode

java.lang.Object
com.example.rocket_launch.NominatimGeocode

public class NominatimGeocode extends Object
Class that takes an address, passes it into a 3rd party API: NominatimGeocode To get a JSON file to derive lat-long coordinates for osmdroid implementation uses OkHttp to handle url and Nominatim integration
  • Constructor Details

    • NominatimGeocode

      public NominatimGeocode()
  • Method Details

    • geocodeAddress

      public String geocodeAddress(String address) throws IOException
      Gets a JSON file from an address through NominatimGeocode
      Parameters:
      address - address that will be geocoded
      Returns:
      a responseBody (JSON file response from 3rd party)
      Throws:
      IOException - exception if the responseBody is null, or an unexpected value
    • getLatLongFromJson

      public org.osmdroid.util.GeoPoint getLatLongFromJson(String jsonResponse) throws org.json.JSONException
      Get the latitude and longitude values from the JSON file and create a GeoPoint
      Parameters:
      jsonResponse - JSON file containing an array of best matching results for an address
      Returns:
      a GeoPoint object for an address
      Throws:
      org.json.JSONException - if GeoPoint can not be made from JSON file, set to a default start point