Skip to main content

Draw geodata in SVG

Project description

svgis

Create simple SVG drawings from geodata files (SHP, geoJSON, OSM, etc).

$ svgis draw in.shp -o out.svg
$ svgis draw in.shp in.geojson -o out.svg

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 -y libgdal1-dev.

Command line options

–bounds

Only draw the portion of the input file between latitudes 40 and 41 and longitudes -74 and -73 (roughly the New York City area). Note that coordinates are given as ‘minx miny maxx maxy’.

svgis draw --bounds -74 40 -73 41 in.geojson out.svg

–scale

While SVG is a vector format, clients may have trouble handling very large numbers. Use the scale option to scale down the output. Dimensions in the map will be divided by this number (so larger numbers yield smaller coordinates in the output SVG).

svgis draw --scale 1000 in.shp -o out.svg

Projections

There are two ways to provide projections. Using both at the same time is unsupported. If the input file doesn’t have an internal projection, SVGIS will assume WGS84.

–epsg

Use this option to provide the EPSG code of a desired projection. The example will draw an svg with EPSG:2908, the New York Long Island state plane projection.

svgis draw --epsg 2908 in.shp -o out.svg

–proj4

Use this option to provide a Proj4 string that defines a projection.

svgis draw --epsg 2908 in.shp -o out.svg

–utm

Attempt to use a local UTM projection to draw the input geodata.

svgis draw --utm in.shp -o out.svg

Style

–style

The style parameter takes either a CSS file or a CSS string.

svgis draw --style style.css in.shp -o out.svg
svgis draw --style "line { stroke: green; }" in.shp -o out.svg

–padding

Adds a padding around the output image.

svgis draw --padding 100 in.shp -o out.svg

–no-viewbox

By default, SVGIS uses a viewbox. If you have a problem opening the created svg file, try the ‘–no-viewbox’ option, which will create an svg where the contents are translated into the frame

svgis draw --no-viewbox in.shp -o out.svg
svgis draw -x in.shp -o out.svg

A note on OSM files

Conversion from OSM can be quite slow. You may find it more efficient to convert to GeoJSON or Shapefile using ogr2ogr or a similar tool.

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

Uploaded Source

Built Distributions

svgis-0.1.3-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

svgis-0.1.3-py2-none-any.whl (16.9 kB view details)

Uploaded Python 2

File details

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

File metadata

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

File hashes

Hashes for svgis-0.1.3.tar.gz
Algorithm Hash digest
SHA256 2aaab9738436e0bdae55d9c20dde1dab122961711e2bf05ebf3482672d0b9f93
MD5 7003fc343b9f668010a87b432c38a863
BLAKE2b-256 cdc062c7f0c2d7dc7c09f7cabf7df4f414037d9cb0d1df01f871417920f28e3a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for svgis-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9ad879e5400c839f6398d28e82f39b518fc886abcc59c98d9dd7ab0ce07a94ab
MD5 dde7b55155c95b1084651ed809665ae6
BLAKE2b-256 b76921bdfb0af63cda619d1799a47f52bc9fed01d68b5320a4789be054497b61

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for svgis-0.1.3-py2-none-any.whl
Algorithm Hash digest
SHA256 8322c6264bdbbf4c68db4163316fbdc410b7b781cbf1a6ef59e6b5abbabcccb4
MD5 e604cbbf34649fbee794721ed86ee850
BLAKE2b-256 b402d8185a9f60d63a71c3dba6aec2c133367b58ac2d6f2f1e4e7def0be9a983

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