Draw geodata in SVG
Project description
SVGIS
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file svgis-0.3.8.tar.gz
.
File metadata
- Download URL: svgis-0.3.8.tar.gz
- Upload date:
- Size: 27.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d661c77628e7ab8145333ddde78007e3ae9c89ce32f46637c5e61d6b66d78c1f |
|
MD5 | 9daf2b9b645a99f8b54b2a38a0550d05 |
|
BLAKE2b-256 | f3d9ebf768efbfa319c5c3b69430c31cf6c60c4a1dd2ad4172bb69a73084deb2 |
File details
Details for the file svgis-0.3.8-py3-none-any.whl
.
File metadata
- Download URL: svgis-0.3.8-py3-none-any.whl
- Upload date:
- Size: 28.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | da1f8522a0d3ac1b6ee00b05cc23b308edc42713a4da459e38f1135f4ca86c97 |
|
MD5 | 87d5452bb393e7a50a42e30515c3d874 |
|
BLAKE2b-256 | c2cd90c1510a60c650dc62376f91783df96f84e6b25b80442c71a0c587f52135 |
File details
Details for the file svgis-0.3.8-py2-none-any.whl
.
File metadata
- Download URL: svgis-0.3.8-py2-none-any.whl
- Upload date:
- Size: 28.6 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd9444e5bdca3642afd4a3335809cc42cf68dbf52d2453bd19cd051465d199f9 |
|
MD5 | 9bc0fe2fea2ef2a4565438d75a0f56f0 |
|
BLAKE2b-256 | 1656b7e1419feedb3ed63bfdc9155489209baca0682978c6c75203cff1e887d6 |