EcohydroLib
1.29
|
Generic utilities for manipulating spatial data sets. More...
Functions | |
def | bboxFromString (bboxStr) |
Get bbox dictionary from comma separated string of the form '-76.769782 39.273610 -76.717498 39.326008'. More... | |
def | isValidSrs (srsString) |
Determine if spatial reference string is valid. More... | |
def | getEPSGStringForUTMZone (zone, isNorth) |
Get EPSG string, e.g. More... | |
def | getUTMZoneFromCoordinates (longitude, latitude) |
Determine the UTM zone for coordinate pair. More... | |
def | transformCoordinates |
Transform a pair of X,Y coordinates from one reference system to another. More... | |
def | getRasterExtentAsBbox (extentRasterFilepath) |
Determine raster extent and store it in a bbox along with the spatial reference system of the raster. More... | |
def | extractTileFromRasterByRasterExtent |
Extract a tile from a raster using the extent of another raster as the tile bounds. More... | |
def | extractTileFromRaster (config, outputDir, inRasterFilename, outRasterFilename, bbox) |
Extract a tile from a raster. More... | |
def | resampleRaster |
Resample raster from one spatial reference system and resolution to another. More... | |
def | rescaleRaster (config, outputDir, inRasterFilepath, outRasterFilename, scalar) |
Rescale DN values of raster. More... | |
def | convertGMLToShapefile (config, outputDir, gmlFilepath, layerName, t_srs) |
Convert a GML file to a shapefile. More... | |
def | convertGMLToGeoJSON |
def | convertGeoJSONToShapefile |
Convert a GeoJSON file to a shapefile. More... | |
def | mergeFeatureLayers |
Combine vector feature files readable by OGR into a single feature layer. More... | |
def | convertFeatureLayerToShapefile |
Convert a vector feature file readible by OGR to a shapefile. More... | |
def | deleteShapefile (shpfilePath) |
Delete shapefile and its related files (.dbf, .prj, .shx) More... | |
def | getCoordinatesOfPointsFromShapefile (shpFilepath, layerName, pointIDAttr, pointIDs) |
Get WGS84 coordinates of point features in shapefile. More... | |
def | deleteGeoTiff (geoTiffPath) |
Delete GeoTIFF and its related files (.aux.xml) More... | |
def | isCoordinatePairInBoundingBox (bbox, coordinates) |
Determine whether coordinate pair lies within bounding box. More... | |
def | calculateBoundingBoxCenter (bbox) |
Calculate the central point of the bounding box. More... | |
def | calculateBoundingBoxArea |
Calculate bbox area in squared units of srs. More... | |
def | tileBoundingBox |
Break up bounding box into tiles if bounding box is larger than threshold. More... | |
def | getBoundingBoxForShapefile |
Return the bounding box, in WGS84 (EPSG:4326) coordinates, for the ESRI shapefile. More... | |
def | bufferBoundingBox (bbox, buffer) |
Buffer the bounding by a given percentage. More... | |
def | getMeterConversionFactorForLinearUnitOfGMLfile (gmlFilename) |
Get conversion factor for converting a GML file's linear unit into meters. More... | |
def | getMeterConversionFactorForLinearUnitOfShapefile (shpFilename) |
Get conversion factor for converting a shapefile's linear unit into meters. More... | |
def | getNodataValuesForRaster (filename) |
Get nodata value for each band in a raster. More... | |
def | getSpatialReferenceForRaster (filename) |
Get pixel size and unit for DEM. More... | |
def | getDimensionsForRaster (filename) |
Get number of columns and rows for raster. More... | |
def | getBoundingBoxForRaster (filename) |
Return the bounding box, in WGS84 (EPSG:4326) coordinates, for the raster dateset. More... | |
def | writeBboxPolygonToShapefile |
Write bbox to a shapfile. More... | |
def | writeCoordinatePairsToPointShapefile |
Write coordinates as a point shapefile. More... | |
def | copyRasterToGeoTIFF (config, outputDir, inRasterPath, outRasterName) |
Copy input raster from a location outside of outputDir to a GeoTIFF format raster stored in outputDir. More... | |
Variables | |
int | SHP_MINX = 0 |
int | SHP_MAXX = 1 |
int | SHP_MINY = 2 |
int | SHP_MAXY = 3 |
list | RASTER_RESAMPLE_METHOD = ['near', 'bilinear', 'cubic', 'cubicspline', 'lanczos', 'average', 'mode'] |
int | WGS84_EPSG = 4326 |
string | WGS84_EPSG_STR = 'EPSG:4326' |
float | NORTH = 0.0 |
float | EAST = 90.0 |
float | BBOX_TILE_DIVISOR = 1.0 |
string | OGR_SHAPEFILE_DRIVER_NAME = 'ESRI Shapefile' |
string | OGR_GEOJSON_DRIVER_NAME = 'GeoJSON' |
dictionary | OGR_DRIVERS |
tuple | EPSG_RE = re.compile('^epsg:\d+$') |
tuple | GDAL_VERSION_RE = re.compile('^GDAL\s(\d{1,2})\.(\d{1,2})\.(\d{1,2}),\sreleased\s\d{4}/\d{2}/\d{2}\s*$') |
Generic utilities for manipulating spatial data sets.
Builds a task-oriented API, for select operations, on top of GDAL/OGR utilities, GDAL/OGR API, Proj API.
This software is provided free of charge under the New BSD License. Please see the following license information:
Copyright (c) 2013, University of North Carolina at Chapel Hill All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Builds a task-oriented API, for select operations, on top of GDAL/OGR utilities, GDAL/OGR API, Proj API.
This software is provided free of charge under the New BSD License. Please see the following license information:
Copyright (c) 2013, University of North Carolina at Chapel Hill All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
def ecohydrolib.spatialdata.utils.bboxFromString | ( | bboxStr | ) |
Get bbox dictionary from comma separated string of the form '-76.769782 39.273610 -76.717498 39.326008'.
bboxStr | String representing bounding box in WGS84 coordinates |
def ecohydrolib.spatialdata.utils.bufferBoundingBox | ( | bbox, | |
buffer | |||
) |
Buffer the bounding by a given percentage.
bbox | A dict containing keys: minX, minY, maxX, maxY, srs, where srs='EPSG:4326' |
buffer | Float >= 0.0 representing number of degrees by which to buffer the bounding box; 0.0 = no buffer, 0.01 = 0.01 degree buffer |
def ecohydrolib.spatialdata.utils.calculateBoundingBoxArea | ( | bbox, | |
srs = WGS84_EPSG_STR |
|||
) |
Calculate bbox area in squared units of srs.
bbox | A dict containing keys: minX, minY, maxX, maxY, srs, where srs='EPSG:4326' |
srs | String representing spatial reference system, in EPSG format, in which area should be calculated. |
def ecohydrolib.spatialdata.utils.calculateBoundingBoxCenter | ( | bbox | ) |
Calculate the central point of the bounding box.
bbox | A dict containing keys: minX, minY, maxX, maxY, srs, where srs='EPSG:4326' |
def ecohydrolib.spatialdata.utils.convertFeatureLayerToShapefile | ( | config, | |
outputDir, | |||
featureFilepath, | |||
shapefileName, | |||
layerName = None , |
|||
t_srs = 'EPSG:4326' , |
|||
overwrite = False |
|||
) |
Convert a vector feature file readible by OGR to a shapefile.
Will silently exit if output shapefile already exists
config | A Python ConfigParser containing the section 'GDAL/OGR' and option 'PATH_OF_OGR2OGR' |
outputDir | String representing the absolute/relative path of the directory into which shapefile should be written |
featureFilepath | String representing the absolute path of the feature file to convert |
layerName | String representing the name of the layer contained in the feature file to write to a shapefile. If none, the base name of featureFilepath will be used |
t_srs | String representing the spatial reference system of the output shapefile, of the form 'EPSG:XXXX' |
Exception | if the conversion failed. |
def ecohydrolib.spatialdata.utils.convertGeoJSONToShapefile | ( | config, | |
outputDir, | |||
geoJSONFilepath, | |||
shapefileName, | |||
layerName = 'OGRGeoJSON' , |
|||
t_srs = 'EPSG:4326' |
|||
) |
Convert a GeoJSON file to a shapefile.
Will silently exit if shapefile already exists
@param config A Python ConfigParser containing the section 'GDAL/OGR' and option 'PATH_OF_OGR2OGR' @param outputDir String representing the absolute/relative path of the directory into which shapefile should be written @param geoJSONFilepath String representing the absolute path of the GeoJSON file to convert @param layerName String representing the name of the layer contained in the GeoJSON file to write to a shapefile @param t_srs String representing the spatial reference system of the output shapefile, of the form 'EPSG:XXXX' @return String representing the name of the shapefile written @exception Exception if the conversion failed.
def ecohydrolib.spatialdata.utils.convertGMLToGeoJSON | ( | config, | |
outputDir, | |||
gmlFilepath, | |||
layerName, | |||
t_srs = 'EPSG:4326' , |
|||
flip_gml_coords = False |
|||
) |
Convert a GML file to a shapefile. Will silently exit if GeoJSON already exists @param config A Python ConfigParser containing the section 'GDAL/OGR' and option 'PATH_OF_OGR2OGR' @param outputDir String representing the absolute/relative path of the directory into which GeoJSON should be written @param gmlFilepath String representing the absolute path of the GML file to convert @param layerName String representing the name of the layer contained in the GML file to write to a GeoJSON @param t_srs String representing the spatial reference system of the output GeoJSON, of the form 'EPSG:XXXX' @return String representing the name of the GeoJSON written @exception Exception if the conversion failed.
def ecohydrolib.spatialdata.utils.convertGMLToShapefile | ( | config, | |
outputDir, | |||
gmlFilepath, | |||
layerName, | |||
t_srs | |||
) |
Convert a GML file to a shapefile.
Will silently exit if shapefile already exists
@param config A Python ConfigParser containing the section 'GDAL/OGR' and option 'PATH_OF_OGR2OGR' @param outputDir String representing the absolute/relative path of the directory into which shapefile should be written @param gmlFilepath String representing the absolute path of the GML file to convert @param layerName String representing the name of the layer contained in the GML file to write to a shapefile @param t_srs String representing the spatial reference system of the output shapefile, of the form 'EPSG:XXXX' @return String representing the name of the shapefile written @exception Exception if the conversion failed.
def ecohydrolib.spatialdata.utils.copyRasterToGeoTIFF | ( | config, | |
outputDir, | |||
inRasterPath, | |||
outRasterName | |||
) |
Copy input raster from a location outside of outputDir to a GeoTIFF format raster stored in outputDir.
config | A Python ConfigParser containing the section 'GDAL/OGR' and option 'PATH_OF_GDAL_TRANSLATE' |
outputDir | String representing the absolute/relative path of the directory into which shapefile should be written |
inRasterPath | String representing path of input raster |
outRasterName | String representing name of output raster to be stored in outputDir |
IOError if gdal_translate binary is not found/executable IOError if output directory does not exist or not writable IOError if input raster is not readable
def ecohydrolib.spatialdata.utils.deleteGeoTiff | ( | geoTiffPath | ) |
Delete GeoTIFF and its related files (.aux.xml)
geoTiffPath | – Path, including filename, of the GeoTIFF to be deleted |
def ecohydrolib.spatialdata.utils.deleteShapefile | ( | shpfilePath | ) |
Delete shapefile and its related files (.dbf, .prj, .shx)
shpfilePath | – Path, including filename, of the shapefile to be deleted |
def ecohydrolib.spatialdata.utils.extractTileFromRaster | ( | config, | |
outputDir, | |||
inRasterFilename, | |||
outRasterFilename, | |||
bbox | |||
) |
Extract a tile from a raster.
Tile extent is defined by supplied bounding box with coordinates defined in WGS84 (EPSG:4326).
config | Python ConfigParser containing the section 'GDAL/OGR' and option 'PATH_OF_GDAL_TRANSLATE' |
outputDir | String representing the absolute/relative path of the directory into which output raster should be written |
inRasterFilename | String representing the name of the input raster |
outRasterFilename | String representing the name of the output raster |
bbox | A dict containing keys: minX, minY, maxX, maxY, srs, where srs='EPSG:4326' (WGS84) |
def ecohydrolib.spatialdata.utils.extractTileFromRasterByRasterExtent | ( | config, | |
outputDir, | |||
extentRasterFilepath, | |||
inRasterFilepath, | |||
outRasterFilename, | |||
resampleMethod = 'near' |
|||
) |
Extract a tile from a raster using the extent of another raster as the tile bounds.
config | Python ConfigParser containing the section 'GDAL/OGR' and option 'PATH_OF_GDAL_WARP' |
outputDir | String representing the absolute/relative path of the directory into which output raster should be written |
extentRasterFilepath | String representing the path of the extent raster |
inRasterFilepath | String representing the path of the raster from which a tile will be extracted |
outRasterFilename | String representing the name of the output raster |
resampleMethod | String representing method to use to resample; one of: RASTER_RESAMPLE_METHOD |
def ecohydrolib.spatialdata.utils.getBoundingBoxForRaster | ( | filename | ) |
Return the bounding box, in WGS84 (EPSG:4326) coordinates, for the raster dateset.
Assumes raster exists and is readable. Code adapted from: http://svn.osgeo.org/gdal/trunk/gdal/swig/python/samples/gdalinfo.py
filename | String representing the DEM file to read pixel size and units |
IOError | if filename is not readable |
Exception | if raster dataset failed to open |
def ecohydrolib.spatialdata.utils.getBoundingBoxForShapefile | ( | shapefileName, | |
buffer = 0.0 |
|||
) |
Return the bounding box, in WGS84 (EPSG:4326) coordinates, for the ESRI shapefile.
Assumes shapefile exists and is readable. Based on http://svn.osgeo.org/gdal/trunk/gdal/swig/python/samples/ogrinfo.py
shapefileName | String representing the path of the shapefile whose bounding box should be determined. |
buffer | Float >= 0.0 representing number of degrees by which to buffer the bounding box; 0.0 = no buffer, 0.01 = 0.01 degree buffer |
def ecohydrolib.spatialdata.utils.getCoordinatesOfPointsFromShapefile | ( | shpFilepath, | |
layerName, | |||
pointIDAttr, | |||
pointIDs | |||
) |
Get WGS84 coordinates of point features in shapefile.
shpFilepath | String representing the path of the shapefile |
layerName | String representing the name of the layer within the shapefile from to read points |
pointIDAttr | String representing name of the attribute used to identify points |
pointIDs | List of strings representing IDs of coordinate pairs |
Exception if unable to read layer of shapefile, or if no feature(s) with given attribute value(s) were found in the shapefile
def ecohydrolib.spatialdata.utils.getDimensionsForRaster | ( | filename | ) |
Get number of columns and rows for raster.
Uses GDAL library Code adapted from: http://svn.osgeo.org/gdal/trunk/gdal/swig/python/samples/gdalinfo.py
filename | String representing the DEM file to read pixel size and units |
IOError | if filename is not readable |
def ecohydrolib.spatialdata.utils.getEPSGStringForUTMZone | ( | zone, | |
isNorth | |||
) |
Get EPSG string, e.g.
"EPSG:32618" for UTM zone (WGS84)
@param zone Integer representing UTM zone @param isNorth True if north @return String of the pattern "^EPSG:\d+$"
def ecohydrolib.spatialdata.utils.getMeterConversionFactorForLinearUnitOfGMLfile | ( | gmlFilename | ) |
Get conversion factor for converting a GML file's linear unit into meters.
gmlFilename | String representing the GML file |
IOError(errno.EACCES) | if the GML file cannot be opened |
def ecohydrolib.spatialdata.utils.getMeterConversionFactorForLinearUnitOfShapefile | ( | shpFilename | ) |
Get conversion factor for converting a shapefile's linear unit into meters.
shpFilename | String representing the name of the shapefile |
IOError(errno.EACCES) | if the shapefile cannot be opened |
def ecohydrolib.spatialdata.utils.getNodataValuesForRaster | ( | filename | ) |
Get nodata value for each band in a raster.
Uses GDAL library Code adapted from: http://svn.osgeo.org/gdal/trunk/gdal/swig/python/samples/gdalinfo.py
filename | String representing the DEM file path |
IOError | if filename is not readable |
def ecohydrolib.spatialdata.utils.getRasterExtentAsBbox | ( | extentRasterFilepath | ) |
Determine raster extent and store it in a bbox along with the spatial reference system of the raster.
extentRasterFilepath | String representing the path of the raster whose extent we are interested in |
IOError(errno.ENOENT) if extentRasterFilepath does not exist IOError(errno.EACCESS) if extentRasterFilepath is not readable
def ecohydrolib.spatialdata.utils.getSpatialReferenceForRaster | ( | filename | ) |
Get pixel size and unit for DEM.
Uses GDAL library Code adapted from: http://svn.osgeo.org/gdal/trunk/gdal/swig/python/samples/gdalinfo.py
filename | String representing the DEM file path |
IOError | if filename is not readable |
def ecohydrolib.spatialdata.utils.getUTMZoneFromCoordinates | ( | longitude, | |
latitude | |||
) |
Determine the UTM zone for coordinate pair.
longitude | Float representing WGS84 longitude |
latitude | Float representing WGS84 latitude |
def ecohydrolib.spatialdata.utils.isCoordinatePairInBoundingBox | ( | bbox, | |
coordinates | |||
) |
Determine whether coordinate pair lies within bounding box.
bbox | A dict containing keys: minX, minY, maxX, maxY, srs, where srs='EPSG:4326' |
coordinates | List of tuples of floats of the form (longitude, latitude), in WGS84 |
def ecohydrolib.spatialdata.utils.isValidSrs | ( | srsString | ) |
Determine if spatial reference string is valid.
Currently, only strings of the form 'EPSG:X...X' are valid.
srsString |
def ecohydrolib.spatialdata.utils.mergeFeatureLayers | ( | config, | |
outputDir, | |||
featureFilepaths, | |||
outLayerName, | |||
outFormat = 'GeoJSON' , |
|||
keepOriginals = False , |
|||
t_srs = 'EPSG:4326' , |
|||
overwrite = False |
|||
) |
Combine vector feature files readable by OGR into a single feature layer.
config | A Python ConfigParser containing the section 'GDAL/OGR' and option 'PATH_OF_OGR2OGR' |
outputDir | String representing the absolute/relative path of the directory into which shapefile should be written |
featureFilepaths | Array of strings representing the absolute path of the feature files to convert |
outLayerName | String representing the name of the merged GeoJSON feature. Extension '.geojson' will be added. |
outFormat | String representing output format supported by OGR listed in OGR_DRIVERS |
keepOriginals | Boolean, if True, original feature layers will be retained (otherwise they will be deleted) |
t_srs | String representing the spatial reference system of the output feature, of the form 'EPSG:XXXX' |
overwrite | Boolean, if True any existing files will be overwritten |
Exception | if OGR returned an error. |
def ecohydrolib.spatialdata.utils.resampleRaster | ( | config, | |
outputDir, | |||
inRasterFilepath, | |||
outRasterFilename, | |||
s_srs, | |||
t_srs, | |||
trX, | |||
trY, | |||
resampleMethod = 'bilinear' |
|||
) |
Resample raster from one spatial reference system and resolution to another.
config | Python ConfigParser containing the section 'GDAL/OGR' and option 'PATH_OF_GDAL_WARP' |
outputDir | String representing the absolute/relative path of the directory into which output raster should be written |
inRasterFilepath | String representing the path of the input raster |
outRasterFilename | String representing the name of the output raster |
s_srs | String representing the spatial reference of the input raster, if s_srs is None, the input raster's spatial reference |
t_srs | String representing the spatial reference of the output raster |
trX | Float representing the X resolution of the output raster (in target spatial reference units) |
trY | Float representing the Y resolution of the output raster (in target spatial reference units) |
resampleMethod | String representing resampling method to use. Must be one of spatialdatalib.utils.RASTER_RESAMPLE_METHOD. |
ConfigParser.NoSectionError | |
ConfigParser.NoOptionError | |
IOError(errno.ENOTDIR) | if outputDir is not a directory |
IOError(errno.EACCESS) | if outputDir is not writable |
ValueError | if trX or trY are not floating point numbers greater than 0 |
Exception | if a gdal_warp command fails |
def ecohydrolib.spatialdata.utils.rescaleRaster | ( | config, | |
outputDir, | |||
inRasterFilepath, | |||
outRasterFilename, | |||
scalar | |||
) |
Rescale DN values of raster.
config | Python ConfigParser containing the section 'GDAL/OGR' and option 'PATH_OF_GDAL_WARP' |
outputDir | String representing the absolute/relative path of the directory into which output raster should be written |
inRasterFilepath | String representing the path of the input raster |
outRasterFilename | String representing the name of the output raster |
scalar | Float representing scalar. Values can run from (-Inf, Inf). |
ConfigParser.NoSectionError | |
ConfigParser.NoOptionError | |
IOError(errno.ENOTDIR) | if outputDir is not a directory |
IOError(errno.EACCESS) | if outputDir is not writable |
ValueError | if scalar is not a floating point number |
Exception | if a gdal_calc.py command fails |
def ecohydrolib.spatialdata.utils.tileBoundingBox | ( | bbox, | |
threshold, | |||
t_srs = WGS84_EPSG_STR , |
|||
divisor = BBOX_TILE_DIVISOR |
|||
) |
Break up bounding box into tiles if bounding box is larger than threshold.
Bounding box must be defined by WGS84 lat,lon coordinates
bbox | Dict containing keys: minX, minY, maxX, maxY, srs, where srs='EPSG:4326' |
threshold | Float representing threshold area above which bounding box will be tiled. Units: sq. meters |
t_srs | String representing spatial reference system, in EPSG format, in which area should be calculated. |
divisor | Float representing amount by which to divide tile sides, such that tile side = sqrt(threshold) / divisor |
def ecohydrolib.spatialdata.utils.transformCoordinates | ( | sourceX, | |
sourceY, | |||
t_srs, | |||
s_srs = "EPSG:4326" |
|||
) |
Transform a pair of X,Y coordinates from one reference system to another.
sourceX | A float representing the X coordinate |
sourceY | A float representing the Y coordinate |
t_srs | A string representing the spatial reference system of the output coordinates |
s_srs | A string representing the spatial reference system, in EPSG format, of the input coordinates |
def ecohydrolib.spatialdata.utils.writeBboxPolygonToShapefile | ( | bbox, | |
outputDir, | |||
layerName, | |||
overwrite = True |
|||
) |
Write bbox to a shapfile.
bbox | A dict containing keys: minX, minY, maxX, maxY, srs, where srs='EPSG:4326' |
outputDir | String representing the absolute/relative path of the directory into which shapefile should be written |
layerName | String representing the name of the layer. Will be used as root of filename of output shapefile |
overwrite | True if existing shapefile should be overwritten. |
IOError is output directory is not a writable directory Exception if shapefile already exists Exception is failed to create shapefile
def ecohydrolib.spatialdata.utils.writeCoordinatePairsToPointShapefile | ( | outputDir, | |
layerName, | |||
pointIDAttr, | |||
pointIDs, | |||
coordinates, | |||
overwrite = True |
|||
) |
Write coordinates as a point shapefile.
outputDir | String representing the absolute/relative path of the directory into which shapefile should be written |
layerName | String representing the name of the layer. Will be used as root of filename of output shapefile |
pointIDAttr | String representing name of the attribute used to identify points |
pointIDs | List of strings representing IDs of coordinate pairs |
coordinates | List of tuples of floats of the form (longitude, latitude), in WGS84 |
overwrite | True if existing shapefile should be overwritten. |
IOError is output directory is not a writable directory Exception if shapefile already exists Exception is failed to create shapefile
float ecohydrolib.spatialdata.utils.BBOX_TILE_DIVISOR = 1.0 |
float ecohydrolib.spatialdata.utils.EAST = 90.0 |
tuple ecohydrolib.spatialdata.utils.EPSG_RE = re.compile('^epsg:\d+$') |
tuple ecohydrolib.spatialdata.utils.GDAL_VERSION_RE = re.compile('^GDAL\s(\d{1,2})\.(\d{1,2})\.(\d{1,2}),\sreleased\s\d{4}/\d{2}/\d{2}\s*$') |
float ecohydrolib.spatialdata.utils.NORTH = 0.0 |
dictionary ecohydrolib.spatialdata.utils.OGR_DRIVERS |
string ecohydrolib.spatialdata.utils.OGR_GEOJSON_DRIVER_NAME = 'GeoJSON' |
string ecohydrolib.spatialdata.utils.OGR_SHAPEFILE_DRIVER_NAME = 'ESRI Shapefile' |
list ecohydrolib.spatialdata.utils.RASTER_RESAMPLE_METHOD = ['near', 'bilinear', 'cubic', 'cubicspline', 'lanczos', 'average', 'mode'] |
int ecohydrolib.spatialdata.utils.SHP_MAXX = 1 |
int ecohydrolib.spatialdata.utils.SHP_MAXY = 3 |
int ecohydrolib.spatialdata.utils.SHP_MINX = 0 |
int ecohydrolib.spatialdata.utils.SHP_MINY = 2 |
int ecohydrolib.spatialdata.utils.WGS84_EPSG = 4326 |
string ecohydrolib.spatialdata.utils.WGS84_EPSG_STR = 'EPSG:4326' |