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 tool

The svgis command line tool includes several utilities. The most important is svgis draw, which draws SVG maps based on input geodata layers.

Additional commands: * svgis bounds: get the bounding box for a layer in a given projection * svgis graticule: create a graticule (grid) within a given bounds * svgis project: determine what projection svgis draw will (optionally) generate for given bounding box * svgis scale: change the scale of an existing SVG * svgis style: add css styles to an existing SVG

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 --crs 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
}
.ne_110m_lakes {
    fill: #09d;
    stroke: none;
}
svgis draw --style style.css --class-fields income_grp ne_110m_admin_0_countries.shp ne_110m_lakes.shp -o out.svg

Draw national boundaries and lakes in Europe using an Albers projection, simplifying the output polygons, and draw Germany in purple.

svgis draw \
    --crs EPSG:102013 \
    --scale 1000 \
    --simplify 90 \
    --style '.ne_110m_admin_0_countries { fill: tan } .Germany { fill: purple }' \
    --style '.ne_110m_lakes { fill: #09d; stroke: none; }' \
    --class-fields name \
    --bounds -10 30 40 65 \
    ne_110m_admin_0_countries.shp ne_110m_lakes.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.6.tar.gz (27.1 kB view details)

Uploaded Source

Built Distributions

svgis-0.3.6-py3-none-any.whl (28.0 kB view details)

Uploaded Python 3

svgis-0.3.6-py2-none-any.whl (28.1 kB view details)

Uploaded Python 2

File details

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

File metadata

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

File hashes

Hashes for svgis-0.3.6.tar.gz
Algorithm Hash digest
SHA256 843f957e398fe5589cf5df51e5bd5776046850dfc9b609b0d9e33a7a24f8b73c
MD5 e385023dec0325772682cf1e3279c09f
BLAKE2b-256 413290c3b9e0693a4724e2904e105bdb13e8a88037798ff13dde7ddd7070cc51

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for svgis-0.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 31bbfe05bd78bda764718efa7a9694ef78d7f93fc49b85743836c14cd07f4c8d
MD5 dcaa026c8b9932dae00b8470fa373641
BLAKE2b-256 5b688da2625945031f7588b3cca618bd984d82ae5132ca1b679be2728cbc6c31

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for svgis-0.3.6-py2-none-any.whl
Algorithm Hash digest
SHA256 55bd958395d1529efd5c74b21ac001ba2086e3042a774a6fbf686b3577f2ba26
MD5 dd1d4372d7165b7326d0250448a5a6f3
BLAKE2b-256 7f9eb28f3baeea5a00c6ff475bb9fa026133e66a76e55bedcd179899ee272873

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