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 great 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. It’s perfect for creating base maps for editing in a drawing program, and its CSS-based styling gives great flexibility for styling.

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

Documentation: http://pythonhosted.org/svgis

Install

Requires fiona, which in turn requires GDAL.

To instal gdal: On OS X: brew install gdal (requires Homebrew) On Linux: sudo apt-get -qq install libgdal1-dev On Windows: see OSGeo4W

Then:

pip install svgis

To support clipping output shapes, download GEOS and install with a slightly different command:

brew install geos # os x
sudo yum/apt-get geos # linux
pip install svgis[clip]

Commands

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 cb_2014_us_nation_20m.shp --crs EPSG:5070 --scale 1000 --bounds -124 20.5 -64 49 -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 ne_110m_admin_0_countries.shp ne_110m_lakes.shp \
    --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 \
    -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.4.0.tar.gz (27.4 kB view details)

Uploaded Source

Built Distributions

svgis-0.4.0-py3-none-any.whl (30.1 kB view details)

Uploaded Python 3

svgis-0.4.0-py2-none-any.whl (30.2 kB view details)

Uploaded Python 2

File details

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

File metadata

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

File hashes

Hashes for svgis-0.4.0.tar.gz
Algorithm Hash digest
SHA256 b215eed5fd99cd0e5a6a7f279b8c8895123cea6fb1f1002cb3b8873a71baf8ea
MD5 b560e7ce2a891cf37f06018f0e36ba25
BLAKE2b-256 7555765aec6f7edb7b02ab2cad980525388559bcf4684e35dc53e63c2ce46df2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for svgis-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f726d5e038d70fb332657f789b9583f0b83545b1c02ab686889bc919566f67d5
MD5 74421d93746bb9ceceb0809357c363f6
BLAKE2b-256 f5227c126032f70a34135ff9b7f7c39146f12b56f514261918374479812ee7cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for svgis-0.4.0-py2-none-any.whl
Algorithm Hash digest
SHA256 557002a91b5161eea765a9a0301d7c9864b9bcf523f49ccec8dff27534a433a3
MD5 648c045a587199ee1ed7a9f3ff4660f4
BLAKE2b-256 1c80fa62d3f741a99791f83e39db2c37cd3ef18164cbe4bd5f3e0ad4b9ae8801

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