lmpy.tools.build_shapegrid

Tool for building shapegrid shapefiles.

Module Contents

Functions

build_shapegrid(shapegrid_file_name, min_x, min_y, max_x, max_y, cell_size, epsg_code, cell_sides, site_id='siteid', site_x='siteX', site_y='siteY', cutout_wkt=None)

Build a shapegrid with an optional cutout.

cli()

Command-line interface to build shapegrid.

lmpy.tools.build_shapegrid.build_shapegrid(shapegrid_file_name, min_x, min_y, max_x, max_y, cell_size, epsg_code, cell_sides, site_id='siteid', site_x='siteX', site_y='siteY', cutout_wkt=None)[source]

Build a shapegrid with an optional cutout.

Parameters
  • shapegrid_file_name (str) – The location to store the resulting shapegrid.

  • min_x (numeric) – The minimum value for X of the shapegrid.

  • min_y (numeric) – The minimum value for Y of the shapegrid.

  • max_x (numeric) – The maximum value for X of the shapegrid.

  • max_y (numeric) – The maximum value for Y of the shapegrid.

  • cell_size (numeric) – The size of each cell (in units indicated by EPSG).

  • epsg_code (int) – The EPSG code for the new shapegrid.

  • cell_sides (int) – The number of sides for each cell of the shapegrid. 4 - square cells, 6 - hexagon cells

  • site_id (str) – The name of the site id field for the shapefile.

  • site_x (str) – The name of the X field for the shapefile.

  • site_y (str) – The name of the Y field for the shapefile.

  • cutout_wkt (None or str) – WKT for an area of the shapegrid to be cut out.

Returns

The number of cells in the new shapegrid.

Return type

int

Raises

ValueError – Raised if invalid bbox or cell sides.

lmpy.tools.build_shapegrid.cli()[source]

Command-line interface to build shapegrid.