Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Suppose I have a set of coordinates in latitude and longitude.

What would be the easiest way to export those to an SVG file?

I'd rather do this programatically (any language or library will do) rather than manually, but can revert to that if necessary.

share|improve this question
up vote 5 down vote accepted

If you have your spatial data in a PostGIS database, try ST_AsSVG, e.g.:

postgis=# SELECT ST_AsSVG(ST_MakePoint(1797227.3141, 5431330.2559));
 cx="1797227.3141000001" cy="-5431330.2559000002"
(1 row)

(The linestring and polygon conversions are much more tricky, and thus very useful to have.)

If you don't use a database and are familiar with C, you can use the liblwgeom library (from PostGIS, but independent of PostgreSQL). See the API docs for lwgeom_to_svg.

Note: these methods only provide parts of the SVG geometric elements, not the file.

share|improve this answer
Perfect, thanks! – Yuval A Oct 14 '11 at 9:42

Manual Method -- The GPS Visualizer takes in coordinates and can export them to a variety of formats, including SVG.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.