Skip to main content

SVGIS

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

SVGIS is great for: creating small multiples, combining lots of datasets in a sensible projection, and drawing styled 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

Complete documentation, with more examples and explanation of classes and methods: https://svgis.readthedocs.io/en/stable/

Install

Requires fiona, which in turn requires GDAL.

See the GDAL docs for install info.

Then:

pip install svgis

An optional feature of svgis is clipping polygons to a bounding box. This will speed things up if you need to draw only part of a very complex feature.

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 the LAEA Europe projection, simplifying the output polygons, and coloring Germany in purple.

svgis draw ne_110m_admin_0_countries.shp ne_110m_lakes.shp \
    --crs EPSG:3035 \ 
    --scale 1000 \ 
    --simplify 90 \ 
    --style '.ne_110m_admin_0_countries { fill: tan } #Germany { fill: purple }' \
    --style '.ne_110m_lakes { fill: #09d; stroke: none; }' \ 
    --id-field name \ 
    --bounds -10 30 40 65 \ 
    -o out.svg

Metadata

Release files for svgis 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for svgis 0.6.0
File Size Uploaded
svgis-0.6.0.tar.gz 864.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for svgis 0.6.0
File Interpreter ABI Platform
svgis-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 904.8 kB

Release files / svgis-0.6.0.tar.gz

Download URL svgis-0.6.0.tar.gz
Size 864.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ad52812ca1754b0e799b4a8d432e1865126e3b94eb2aaf9d49a71a64610a1866
BLAKE2b-256 checksum
How to use checksums
16a70a71b356a2383dd8303889ae4d986aaf84acc8e093d6a21d924429be698f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.5

Release files / svgis-0.6.0-py3-none-any.whl

Download URL svgis-0.6.0-py3-none-any.whl
Size 40.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a63e3b404d8ef6788ad1742d8e2266a708739bfe8e88db7eae763fad5323ce3d
BLAKE2b-256 checksum
How to use checksums
90d4e950d14ee437a207889d10f1ae8e26906313d530da434d1d907e1792d3f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.5

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

3 release files

0.3.9

3 release files

0.3.8

3 release files

0.3.7

3 release files

0.3.6

3 release files

0.3.5

3 release files

0.3.4

3 release files

0.3.3

3 release files

0.3.2

3 release files

0.3.1

3 release files

0.3.0

0.2.4

3 release files

0.2.3

3 release files

0.2.1

3 release files

0.2.0

3 release files

0.1.4

3 release files

0.1.3

3 release files

0.1.2

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page