classes package¶
Submodules¶
classes.config module¶
System-wide configuration
Assumes the existence of the file ‘api_credentials.ini’ for accessing the NISMODDB++ API. This should reside in
the same directory (‘classes’) as this file, and contain the following lines:
[API_CREDENTIALS]
username = <api_username>
password = <api_password>
Note that no extra quotation marks are required around the credentials.
Created on Wed Jun 5 16:22:55 2019
@author: ndh114
classes.fishnet module¶
Fishnet creation class
Created on Wed Jun 5 14:41:41 2019
@author: ndh114
-
class
classes.fishnet.FishNet(outfile=None, outformat='GeoJSON', lad=None, bbox=[90000.0, 10000.0, 400000.0, 660000.0], netsize=100.0)¶ Bases:
objectConstructorKeyword arguments:outfile – filename to write the fishnet output to (default None, indicating return the data as GeoJSON string)outformat – ESRI Shapefile|GeoJSON, (default ‘GeoJSON’)lad – Local Authority District code(s) to deduce bounds from (‘all’ to use all)(default None, will be used preferentially to bbox if supplied)bbox – Bounding box of interest (default to bounding box of England and Wales)netsize – Resolution of the grid in metres (default 100.0)Returns:full file path (outfile supplied), or GeoJSON string (outfile not supplied)-
create()¶ - Generate the fishnet dataset, based on the code at
-
read_file(filename)¶ Read an in-memory file https://gis.stackexchange.com/questions/255153/gdal-vectortranslate-returns-an-empty-file also see: https://gis.stackexchange.com/questions/318916/getting-png-binary-data-from-gdaldataset
-
classes.rasteriser module¶
Rasteriser class
Created on Mon Jun 17 14:30:23 2019
@author: ndh114
-
class
classes.rasteriser.Rasteriser(geojson_data, area_codes=[], bounding_box=None, fishnet=None, scale='lad', output_filename='output_raster.tif', output_format='GeoTIFF', resolution=100.0, area_threshold=50.0, invert=True)¶ Bases:
objectConstructorKeyword arguments:geojson_data – extracted GeoJSON dataarea_codes – boundary specified by area code list ORbounding_box – as a bounding box as a list [xmin, ymin, xmax, ymax] ORfishnet – as existing fishnet GeoJSON output from the FishNet classscale – scale to look at (oa|lad|gor)output_filename – output filenameoutput_format – raster output file format (GeoTIFF|ASCII)resolution – fishnet sampling resolution in metresarea_threshold – minimum data area within a cell to trigger raster inclusioninvert – True if output raster gets a ‘0’ for areas > thresholdReturns:full file path (output_filename supplied)-
create()¶ - Generate the output raster dataset
-
debug_dump_geojson_to_file(filename, json_data)¶ Dump the given JSON data to a file for examination
-