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. 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 --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.7.tar.gz (27.6 kB view details)

Uploaded Source

Built Distributions

svgis-0.3.7-py3-none-any.whl (28.4 kB view details)

Uploaded Python 3

svgis-0.3.7-py2-none-any.whl (28.5 kB view details)

Uploaded Python 2

File details

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

File metadata

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

File hashes

Hashes for svgis-0.3.7.tar.gz
Algorithm Hash digest
SHA256 0c79d88cbfc2373d48bd7ea95ddf7f299827593b7187b11e2c024e99a8d411cd
MD5 716ea0accf25a42945dd2142dca2466f
BLAKE2b-256 737061ddb6cde1f3f36f4d2d3d325276f5fcd2b0330c017c8e858568e2f32067

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for svgis-0.3.7-py3-none-any.whl
Algorithm Hash digest
SHA256 bdb6f75b5b8943ab67cc493487aeb7eeb5b44ea4daf2faa1e41db5d9434d958b
MD5 9b5b511cd8f8c6f831c7dd3025f32227
BLAKE2b-256 42eba16538faa4eb0fc470d822f5551785c3ba7fc211210596fe9ca94c777424

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for svgis-0.3.7-py2-none-any.whl
Algorithm Hash digest
SHA256 185dd71bf077b62da14d897b5b98877536cf84dc2fdfc0692af152a91b110ed5
MD5 7544b809b29c349151559c6c9e245d9f
BLAKE2b-256 f98abeff2a1cb1c2c2b578f4f9bcdf5276aa3fef26578781a97e6b76cdc96c59

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