planetsca.simplify_aoi

Functions to simplify a geometry for an area of interest (AOI). Searching for Planet imagery via their API using a geometry filter requires that the geometry is not too complex.

simplify_aoi.check_hole(file_path)[source]

Checks if a polygon contains a hole.

Parameters:

file_path (str) – Path location of geojson file

Returns:

boolean – True if there is a hole in the polygon, false if there is not

Return type:

bool

simplify_aoi.check_overlap(file_path: str) bool[source]

Checks if two polygons are overlapping from a GeoJSON file

Parameters:

file_path (str) – Path location of geojson file

Returns:

boolean – True if there is overlap and false if there is no overlap

Return type:

bool

simplify_aoi.clipping_check(file_path: str, AOI_Coordinates: list) bool[source]

Checks if a given polygon clips outside the contracted AOI coordinates

Parameters:
  • file_path (str) – Path location of geojson file

  • AOI_Coordinates (List[float]) – List of coordinates representing the AOI bounds

Returns:

boolean – True if it clips outside and false if it does not

Return type:

bool

simplify_aoi.fill_holes(file_path: str)[source]

Fills holes of GeoJSON by deleting interior ring coordinates and creating a new GeoJSON with new coordinates

Parameters:

file_path (str) – Path location of geojson file

simplify_aoi.fix_clipping(file_path: str, AOI_Coordinates: list)[source]

Deletes all parts of a Polygon that exceed the AOI coordinate bounds

Parameters:
  • file_path (str) – Path location of geojson file

  • AOI_Coordinates (List[float]) – List of coordinates representing the AOI bounds

simplify_aoi.fix_overlap(file_path: str)[source]

Fixes the overlap of two polygons by deleting the overlapped area and merging the two polygons into one polygon

Parameters:

file_path (str) – Path location of geojson file

simplify_aoi.get_coordinates(file_path)[source]

Helper Method - Gets coordinates from a GeoJSON file

Parameters:

file_path (str) – Path location of geojson file

Returns:

coordinates_list – List of vertices from GeoJSON polygon

Return type:

List[float]

simplify_aoi.reduce_vertex(file_path, ratio)[source]

Reduces the number of vertices in a polygon

Parameters:
  • file_path (str) – Path location of geojson file

  • ratio (float) – Sets the concave_hull ratio

simplify_aoi.simplify(file_path: str, ratio: int, AOI_Coordinates: list)[source]

Runs all checks and fixes to adhere to Planet’s AOI Geometry Limits

Parameters:
  • file_path (str) – Path location of geojson file

  • AOI_Coordinates (List[float]) – List of coordinates representing the AOI bounds

simplify_aoi.vertex_count(file_path)[source]

Counts vertices from a GeoJSON file.

Parameters:

file_path (str) – Path location of geojson file

Returns:

vertex_num – Number of vertices in geojson file

Return type:

int