gnome.utilities.geometry.geo_routines

Module Contents

Functions

geo_area_of_polygon(poly)

param poly:

triangulate_poly(poly)

param poly:

shapely or geojson MultiPolygon or Polygon

poly_area_weight(polys[, geo_area])

param polys:

iterable of shapely.Polygon

mixed_polys_to_polygon(polys)

param polys:

iterable containing mixed Polygon and MultiPolygon

check_valid_polygon(poly)

checks that a shapely Polygon object at least has valid values for coordinates

random_pt_in_tri(tri)

load_shapefile(filename[, transform_crs])

Use GeoPandas to load up a shapefile into a FeatureCollection

Attributes

geod

gnome.utilities.geometry.geo_routines.geod
gnome.utilities.geometry.geo_routines.geo_area_of_polygon(poly)
Parameters:

poly (shapely or geojson MultiPolygon or Polygon) –

Returns:

area of polygon in m^2

gnome.utilities.geometry.geo_routines.triangulate_poly(poly)
Parameters:

poly – shapely or geojson MultiPolygon or Polygon

Returns:

list of shapely.Polygon (triangles)

gnome.utilities.geometry.geo_routines.poly_area_weight(polys, geo_area=False)
Parameters:
  • polys – iterable of shapely.Polygon

  • geo_area – If true, calculates using geo area (slower, more accurate)

gnome.utilities.geometry.geo_routines.mixed_polys_to_polygon(polys)
Parameters:

polys – iterable containing mixed Polygon and MultiPolygon

Returns:

iterable of shapely.Polygon

gnome.utilities.geometry.geo_routines.check_valid_polygon(poly)

checks that a shapely Polygon object at least has valid values for coordinates

gnome.utilities.geometry.geo_routines.random_pt_in_tri(tri)
gnome.utilities.geometry.geo_routines.load_shapefile(filename, transform_crs=True)

Use GeoPandas to load up a shapefile into a FeatureCollection

Parameters:
  • filename – string path of a zip file

  • transform_crs – attempts to read the .prj file if any and convert to EPSG:4326

Returns:

geojson.FeatureCollection