ost.helpers.vector

Functions

aoi_to_wkt

Helper function to transform various AOI formats into WKT

buffer_shape

difference

epsg_to_wkt_projection

param epsg_code

exterior

Creates an exterior vector of an input vector

gdf_to_json_geometry

Function to parse features from GeoDataFrame in such a manner that rasterio wants them

geodesic_point_buffer

param lat

get_epsg

param prjfile

get_proj4

Get the proj4 string from a projection file of a shapefile

latlon_to_shp

param lon

latlon_to_wkt

A helper function to create a WKT representation of Lat/Lon pair

plot_inventory

reproject_geometry

Reproject a wkt geometry based on EPSG code

set_subset

shp_to_wkt

A helper function to translate a shapefile into WKT

wkt_manipulations

param wkt

wkt_to_gdf

param wkt

ost.helpers.vector.aoi_to_wkt(aoi)[source]

Helper function to transform various AOI formats into WKT

This function is used to import an AOI definition into an OST project. The AOIs definition can be from difffrent sources, i.e. an ISO3 country code (that calls GeoPandas low-resolution country boundaries), a WKT string,

Parameters

aoi (str/Path) – AOI , which can be an ISO3 country code, a WKT String or a path to a shapefile, a GeoPackage or a GeoJSON file

Returns

AOI as WKT string

Return type

WKT string

ost.helpers.vector.buffer_shape(infile, outfile, buffer=None)[source]
ost.helpers.vector.difference(infile1, infile2, outfile)[source]
ost.helpers.vector.epsg_to_wkt_projection(epsg_code)[source]
Parameters

epsg_code

Returns

ost.helpers.vector.exterior(infile, outfile, buffer=None)[source]

Creates an exterior vector of an input vector

Parameters
  • infile

  • outfile

  • buffer

Returns

ost.helpers.vector.gdf_to_json_geometry(gdf)[source]

Function to parse features from GeoDataFrame in such a manner that rasterio wants them

ost.helpers.vector.geodesic_point_buffer(lon, lat, meters, envelope=False)[source]
Parameters
  • lat

  • lon

  • meters

  • envelope

Returns

ost.helpers.vector.get_epsg(prjfile)[source]
Parameters

prjfile

Returns

ost.helpers.vector.get_proj4(prjfile)[source]

Get the proj4 string from a projection file of a shapefile

Parameters

prjfile

Returns

ost.helpers.vector.latlon_to_shp(lon, lat, shapefile)[source]
Parameters
  • lon

  • lat

  • shapefile

Returns

ost.helpers.vector.plot_inventory(aoi, inventory_df, transparency=0.05, annotate=False)[source]
ost.helpers.vector.reproject_geometry(geom, inproj4, out_epsg)[source]

Reproject a wkt geometry based on EPSG code

Parameters
  • geom – an ogr geom object

  • inproj4 – a proj4 string

  • out_epsg – the EPSG code to which the geometry should transformed

Returns

the transformed geometry (ogr-geometry object)

ost.helpers.vector.set_subset(aoi, inventory_df)[source]
ost.helpers.vector.shp_to_wkt(shapefile, buffer=None, convex=False, envelope=False)[source]

A helper function to translate a shapefile into WKT

Parameters
  • shapefile

  • buffer

  • convex

  • envelope

Returns

ost.helpers.vector.wkt_manipulations(wkt, buffer=None, convex=False, envelope=False)[source]
Parameters
  • wkt

  • buffer

  • convex

  • envelope

Returns

ost.helpers.vector.wkt_to_gdf(wkt)[source]
Parameters

wkt

Returns