Skip to main content

Draw geodata in SVG

Project description

SVGIS

Build Status Coverage Status

Create SVG drawings from vector geodata files (SHP, geoJSON, etc).

SVGIS is good for: creating small multiples, combining lots of datasets in a sensible projections, and drawing maps with basic styles based on classes in the source data.

svgis draw input.shp -o out.svg
svgis draw --project utm south_dakota.shp north_dakota.geojson -o dakota.svg
svgis draw --style my.css england.shp scotland.shp wales.shp -o great_britain.svg

Documentation: http://pythonhosted.org/svgis

Install

Requires fiona, which in turn requires GDAL.

Before installing, run the following on OS X: brew install gdal. On Linux: sudo apt-get -qq install libgdal1-dev.

Then:

pip install svgis

An additional feature is available if you want to download more prerequisites:

# Clip output shapes to the bounding box (smaller files)
brew install geos # os x
sudo yum/apt-get geos # linux
pip install svgis[clip]

Command line tools

The svgis command line tool has several commands: bounds, draw, project, scale and style. svgis scale and svgis style will add a scaling factor or CSS style to an existing SVG file. svgis project is a utility for determining what projection svgis draw will (optionally) generate for given bounding boxes. svgis bounds returns the bounding box for a layer in a given projection. Read the docs for complete information on these commands and their options.

Examples

Draw the outline of the contiguous United States, projected in Albers:

curl -O http://www2.census.gov/geo/tiger/GENZ2014/shp/cb_2014_us_nation_20m.zip
unzip cb_2014_us_nation_20m.zip
svgis draw --project EPSG:5070 --scale 1000 --bounds -124 20.5 -64 49 cb_2014_us_nation_20m.shp -o us.svg

The next two examples use the Natural Earth admin-0 data set.

Draw upper income countries in green, low-income countries in blue:

/* style.css */
.income_grp_5_Low_income {
    fill: blue
}
.income_grp_3_Upper_middle_income {
    fill: green
}
svgis draw --style style.css --class-fields income_grp ne_110m_admin_0_countries.shp -o out.svg

Draw national boundaries in the Europe using an Albers projection, simplifying the output polygons, and draw Germany in purple. `svgis draw \ --project EPSG:102013 \ --scale 1000 \ --simplify 0.10 \ --style ".Germany { fill: purple }" \ --class-fields name \ --bounds -10 30 40 65 \ ne_110m_admin_0_countries.shp \ -o out.svg

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

svgis-0.3.5.tar.gz (25.3 kB view details)

Uploaded Source

Built Distributions

svgis-0.3.5-py3-none-any.whl (25.6 kB view details)

Uploaded Python 3

svgis-0.3.5-py2-none-any.whl (25.6 kB view details)

Uploaded Python 2

File details

Details for the file svgis-0.3.5.tar.gz.

File metadata

  • Download URL: svgis-0.3.5.tar.gz
  • Upload date:
  • Size: 25.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for svgis-0.3.5.tar.gz
Algorithm Hash digest
SHA256 08e19094e08d5f5e50a6ff522c2df62b0aee1cb9199f09e118749fa0fa2befb8
MD5 ec2e863ae89017a012161e03315783c1
BLAKE2b-256 f06900b635cd8851a7c96db79b7f13fff2e6b1cf2779874795ecebe5e8636292

See more details on using hashes here.

File details

Details for the file svgis-0.3.5-py3-none-any.whl.

File metadata

File hashes

Hashes for svgis-0.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 e9848caf8adb1f0de8ada03da28e5467a1014ad1fa74ef8a6e081f1aed063e46
MD5 64c46814733789bf924ae776bc066c64
BLAKE2b-256 1a9090a844fb06a24cfe6b2cd910bd067a999e7e3454d5eaff8d308817123a58

See more details on using hashes here.

File details

Details for the file svgis-0.3.5-py2-none-any.whl.

File metadata

File hashes

Hashes for svgis-0.3.5-py2-none-any.whl
Algorithm Hash digest
SHA256 8116464e3119cbbd4a61ac27836d9c7fca4d9709f9dfcc5dc67d57bc56480b29
MD5 b5faa9caa25f6f65bc38bbfb9e176d8a
BLAKE2b-256 13f166de516793ce5324406cec9fe78ec0d6444d9063717ec6dd93a8a5a5e095

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page