Class GeotoolsUtil

java.lang.Object
de.dlr.proseo.geotools.rest.GeotoolsUtil

@Component public class GeotoolsUtil extends Object
A utility class for working with geospatial data. It provides methods for checking if a point or polygon is inside or overlaps with certain regions defined by shape files (provided in application.yml).
  • Field Details

  • Constructor Details

    • GeotoolsUtil

      public GeotoolsUtil()
  • Method Details

    • getInfo

      Retrieves information about the loaded shapes
      Returns:
      information about the loaded shapes
      Throws:
      UnsupportedOperationException - if a valid, but not yet handled file type was given
      IllegalArgumentException - if an invalid file type was given
      IOException - if the shape file could not be opened created successfully
    • isPointInside

      public Boolean isPointInside(Double latitude, Double longitude, String[] types) throws UnsupportedOperationException, IllegalArgumentException, IOException
      Checks whether the geographical point defined by latitude and longitude is inside of at least one of the provided regions
      Parameters:
      latitude - a Double describing the latitude of the coordinate
      longitude - a Double describing the longitude of the coordinate
      types - the types parameter is used to determine which region types to check if a given point is inside. If the types parameter is null or empty, it will consider all available region types stored in the shapeMap. Otherwise, it will only check the specified region types.
      Returns:
      true if the coordinate is contained in at least one of the provided regions (or all known regions if none were provided)
      Throws:
      UnsupportedOperationException - if a valid, but not yet handled file type was given
      IllegalArgumentException - if an invalid file type was given
      IOException - if the shape file could not be opened created successfully
    • isPointInside

      public Boolean isPointInside(Double latitude, Double longitude, ShpFile shpFile) throws UnsupportedOperationException, IllegalArgumentException, IOException
      Checks whether the geographical point defined by latitude and longitude is contained in the region described by the provided shpFile
      Parameters:
      latitude - a Double describing the latitude of the coordinate
      longitude - a Double describing the longitude of the coordinate
      shpFile - the shape file against which to compare the coordinate
      Returns:
      true if the geographical point defined by latitude and longitude is contained in the region described by the provided shpFile
      Throws:
      UnsupportedOperationException - if a valid, but not yet handled file type was given
      IllegalArgumentException - if an invalid file type was given or either input is missing
      IOException - if the shape file could not be opened created successfully
    • isPolyInside

      Checks whether the geographical area defined by the RestPolygon is contained in one or more of the region types. All available region types will be checked if none were specified.
      Parameters:
      poly - a RestPolygon
      types - the types parameter is used to determine which region types to check if a given point is inside. If the types parameter is null or empty, it will consider all available region types stored in the shapeMap. Otherwise, it will only check the specified region types.
      Returns:
      true if poly is inside
      Throws:
      UnsupportedOperationException - if a valid, but not yet handled file type was given
      IllegalArgumentException - if an invalid file type was given
      IOException - if the shape file could not be opened created successfully
    • isPolyOverlap

      Check whether the geographical area defined by the RestPolygon overlaps one or more of the region types. All available region types will be checked if none were specified.
      Parameters:
      poly - a RestPolygon
      types - the types parameter is used to determine which region types to check if a given point is inside. If the types parameter is null or empty, it will consider all available region types stored in the shapeMap. Otherwise, it will only check the specified region types.
      Returns:
      true if poly overlaps one or more of the regions, false otherwise
      Throws:
      UnsupportedOperationException - if a valid, but not yet handled file type was given
      IllegalArgumentException - if an invalid file type was given
      IOException - if the shape file could not be opened created successfully