Not too long ago, I covered an online application from indiemapper that converts shapefiles into SVG format, a standard format for vector illustration programs like Adobe Illustrator or the open source Inkscape. One drawback of that site was the inability to color/shade the SVG output based on shapefile attribute data. Ken Hardy has a Perl utility called shptosvg that will take shapefiles and convert them into SVG format, and includes the ability to color files based on their attributes:
Features (from the website):
- Accepts source SRS specs on the command line, allowing multiple input files to have disparate coordinate systems.
- Generates the results projected to any SRS using Geo::Proj4.
- Works on multiple shapefiles at a single invocation, layering them in order into the SVG map.
- Supports specification of color and other rendering options, per source file, on the command line.
- Optionally select subset of shapes by regex on arbitrary attribute fields.
- Support coloring of shapes by value of an attribute field.
- Allow specification of a shapefile to use in scaling but not in rendering. That supports independent production of layers to be later combined in an SVG editor; they can all be scaled and translated according to the geometry of the base/largest layer to aid layering after the fact.
You’ll need to have Perl installed on your system; see the download page on the official Perl site for links to several different versions. And you’ll need to be comfortable working in a command-line interface; no GUI available yet. Ken has a page documenting usage, along with an example page that describes how he created the image above.
HT to Ken (of course).
Not the same thing, but OpenJump, the free Java GIS, allows to save its view as SVG file. So you can save not only one whole map layer, but also map composition, and it can be rendered with all the colours, line and fill styles, annotations, background rasters and so on.
Oh, I commented a little too fast. The script does almost all I mentioned. OpenJump does basically the same thing (plus the rasters, plus more input formats supported, minus the reprojection and few other differences) and its “Save view as SVG” function could be used as GUI-based alternative to the shptosvg script in many cases.
I think that while OpenJump is now quite well known to exist, many people still do not know about some of its little handy features like this one. So I hope this messy post was still helpful.