项目作者: mapbox

项目描述 :
Vector surfaces creation routines
高级语言: Python
项目地址: git://github.com/mapbox/make-surface.git
创建时间: 2014-08-05T14:14:46Z
项目社区:https://github.com/mapbox/make-surface

开源协议:MIT License

下载


makesurface cool-tools

Raster —> vector surface creation tools in python

Installation

From GitHub:

pip install -e git+git@github.com:mapbox/make-surface.git#egg=makesurface

From PyPI

pip install makesurface --pre

Manual

  1. Install dependencies:

‘click>=3.0’, ‘fiona’, ‘numpy’, ‘rasterio’, ‘shapely’, ‘scipy’, ‘mercantile’, ‘pyproj’

  1. Clone this repo:

:console:git clone git@github.com:mapbox/make-surface.git

  1. cd into :console:make-surface then pip install -e .

Usage - Vectorize

makesurface vectorize [OPTIONS] INFILE

Takes an input raster, and converts into a stacked shapefile. Sort of like gdal polygonize with more control, optimized for vector tiles. Also can print out a CartoCSS template for stylizing (one style for each class).

image

Options:

  1. --outfile TEXT Write to GeoJSON
  2. -b, --bidx INTEGER Input band to vectorize. [default = 1]
  3. -cl, --classes TEXT Number of output classes, OR "all" for rounded
  4. input values (ignored if class file specified)
  5. [default = 10]
  6. -cf, --classfile TEXT One-line CSV of break values [default = None]
  7. -w, --weight FLOAT Weighting between equal interval and quantile
  8. breaks [default = 1 / equal interval]
  9. -s, --smoothing INTEGER Value by which to zoom and smooth the data [default
  10. = None]
  11. -n, --nodata TEXT Manually defined nodata value - can be any number
  12. or "min" [default = None]
  13. -ov, --outvar TEXT Name of output variable [Default = value]
  14. -set, --setnodata FLOAT Value to set nodata to (eg, if nodata / masked, set
  15. pixel to this value) [default = None]
  16. -c, --carto
  17. -ni, --nibble Expand mask by 1 pixel
  18. --axonometrize FLOAT EXPERIMENTAL
  19. -ns, --nosimple
  20. --help Show this message and exit.

Usage - Triangulate

makesurface triangulate [OPTIONS] ZOOM

Creates an empty triangular lattice:

  1. Options:
  2. --bounds FLOAT... Bounding Box ("w s e n") to create lattice in
  3. --tile INTEGER... Tile ("x y z") to create lattice in
  4. --output TEXT File to write to (.geojson)
  5. --tableid TEXT static id for databases
  6. --help Show this message and exit.

Usage - fillfacets

makesurface fillfacets [OPTIONS] SAMPLERASTER [INFILE]

Use GeoJSON-like triangle geometry to get average regional raster value for that geometry

image

Options:

  1. --output TEXT Write output to .json [default - print to stdout]
  2. -b, --bidxs TEXT... Band to sample [default=1]
  3. --zooming INTEGER Manual upsampling of raster for sampling [Default =
  4. upsampling by estimated polygon density]
  5. -np, --noproject Do not project data
  6. -ogjs, --outputgeojson Output updated GeoJSON
  7. -bp, --batchprint TEXT
  8. -cl, --color
  9. --help Show this message and exit.