Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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
add comment

2 Answers

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));
                     st_assvg
--------------------------------------------------
 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
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

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.