Package de.dlr.proseo.geotools.rest
Class GeotoolsUtil
java.lang.Object
de.dlr.proseo.geotools.rest.GeotoolsUtil
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetInfo()Retrieves information about the loaded shapesisPointInside(Double latitude, Double longitude, ShpFile shpFile) Checks whether the geographical point defined by latitude and longitude is contained in the region described by the provided shpFileisPointInside(Double latitude, Double longitude, String[] types) Checks whether the geographical point defined by latitude and longitude is inside of at least one of the provided regionsisPolyInside(RestPolygon poly, String[] types) Checks whether the geographical area defined by the RestPolygon is contained in one or more of the region types.isPolyOverlap(RestPolygon poly, String[] types) Check whether the geographical area defined by the RestPolygon overlaps one or more of the region types.
-
Field Details
-
geotoolsConfig
Geotools configuration
-
-
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 givenIllegalArgumentException- if an invalid file type was givenIOException- 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 coordinatelongitude- a Double describing the longitude of the coordinatetypes- 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 givenIllegalArgumentException- if an invalid file type was givenIOException- 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 coordinatelongitude- a Double describing the longitude of the coordinateshpFile- 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 givenIllegalArgumentException- if an invalid file type was given or either input is missingIOException- if the shape file could not be opened created successfully
-
isPolyInside
public Boolean isPolyInside(RestPolygon poly, String[] types) throws UnsupportedOperationException, IllegalArgumentException, IOException 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 RestPolygontypes- 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 givenIllegalArgumentException- if an invalid file type was givenIOException- if the shape file could not be opened created successfully
-
isPolyOverlap
public Boolean isPolyOverlap(RestPolygon poly, String[] types) throws UnsupportedOperationException, IllegalArgumentException, IOException 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 RestPolygontypes- 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 givenIllegalArgumentException- if an invalid file type was givenIOException- if the shape file could not be opened created successfully
-