GRASS vector export to Inkscape: Difference between revisions

From GRASS-Wiki
Jump to navigation Jump to search
No edit summary
 
(10 intermediate revisions by 5 users not shown)
Line 1: Line 1:
Inkscape [http://www.inkscape.org Inkscape] is a free vector graphics program. The native data format is 'svg' which means 'scaleable vector graphics'. The only problem is that there is no direct svg export module in GRASS. But there is a shapefile to svg converter [http://www.carto.net/papers/svg/utils/shp2svg/ shp2svg converter].
__TOC__
 
== What is Inkscape ==
[http://www.inkscape.org Inkscape] is a free vector graphics program. The native data format is 'svg' which means 'scalable vector graphics'. The only problem is that there is no direct svg export module in GRASS. But there is a shapefile to svg converter [http://www.carto.net/papers/svg/utils/shp2svg/ shp2svg converter].


Inkscape uses a coordinate system which represents the final map output (i.e. 210mm x 297mm for A4). Therefore a scaling of the geographic coordinate system is needed. I've get good results from a lat/long region with the following command:
Inkscape uses a coordinate system which represents the final map output (i.e. 210mm x 297mm for A4). Therefore a scaling of the geographic coordinate system is needed. I've get good results from a lat/long region with the following command:


ogis2svg.exe --input yourinputShapeFile --output youroutputfile.svg --roundval 0.00001 --scale 0.01
  ogis2svg.exe --input yourinputShapeFile --output youroutputfile.svg --roundval 0.00001 --scale 0.01


You can also use the scale 1 and adept the transformation in incscape (scale(100)).
You can also use the scale 1 and adept the transformation in incscape (scale(100)).


If you wan't to import several files into Inkscape you'll have to place them all at the same place. To do this, use the XML-Editor from Inkscape (View->XML Editor) and check that the transformation is the same for all object (for example: 'transform translate(-7400,1850)')
If you want to import several files into Inkscape you'll have to place them all at the same place. To do this, use the XML-Editor from Inkscape (View->XML Editor) and check that the transformation is the same for all objects (for example: 'transform translate(-7400,1850)')


== Samples ==
A sample file can be found here: [http://perswww.kuleuven.ac.be/~u0049353/grass/laos-overview.svg Inkscape demo map]
A sample file can be found here: [http://perswww.kuleuven.ac.be/~u0049353/grass/laos-overview.svg Inkscape demo map]


As you see, I haven't figured out yet how I could use an geographic grid in Incscape, so that I could add a point or line at specified coordinates. So if anybody has a clue....
As you see, I haven't figured out yet how I could use a geographic grid in Inkscape, so that I could add a point or line at specified coordinates. So if anybody has a clue....
 
 
Here comes a clue: draw a line in Inkscape, select it then ctrl+shift+x. Now you can see the syntax for a line:
 
M (moveto) X,Y
 
L (lineto) X,Y
 
L ...
 
L ...
 
 
 
Seems like SVG doesn't define 'Point' element:
http://www.w3.org/TR/SVG/shapes.html (+path+text)
 
== More tips on how to use SVG for map layouts ==
  I prefer to setup my Grass vectors in QGIS print composer (layers,
  labels, legend, scale and many more nice stuff), print that as SVG and
  then load into Inkscape for some fine-tunning.
  Maciek
 
== v.out.svg ==
 
A module for exporting GRASS vectors was developed by Klaus Förster. The sourcecode of the module <strike>can be obtained here: http://svg.cc/grass/index.html</strike> is included in the latest GRASS release.
 
== Convert SVG to EPS for ps.map ==
 
* See instructions [[IconSymbols#Symbol_families|here]].
 
[[Category:Documentation]]

Latest revision as of 19:01, 7 May 2008

What is Inkscape

Inkscape is a free vector graphics program. The native data format is 'svg' which means 'scalable vector graphics'. The only problem is that there is no direct svg export module in GRASS. But there is a shapefile to svg converter shp2svg converter.

Inkscape uses a coordinate system which represents the final map output (i.e. 210mm x 297mm for A4). Therefore a scaling of the geographic coordinate system is needed. I've get good results from a lat/long region with the following command:

 ogis2svg.exe --input yourinputShapeFile --output youroutputfile.svg --roundval 0.00001 --scale 0.01

You can also use the scale 1 and adept the transformation in incscape (scale(100)).

If you want to import several files into Inkscape you'll have to place them all at the same place. To do this, use the XML-Editor from Inkscape (View->XML Editor) and check that the transformation is the same for all objects (for example: 'transform translate(-7400,1850)')

Samples

A sample file can be found here: Inkscape demo map

As you see, I haven't figured out yet how I could use a geographic grid in Inkscape, so that I could add a point or line at specified coordinates. So if anybody has a clue....


Here comes a clue: draw a line in Inkscape, select it then ctrl+shift+x. Now you can see the syntax for a line:

M (moveto) X,Y

L (lineto) X,Y

L ...

L ...


Seems like SVG doesn't define 'Point' element: http://www.w3.org/TR/SVG/shapes.html (+path+text)

More tips on how to use SVG for map layouts

 I prefer to setup my Grass vectors in QGIS print composer (layers,
 labels, legend, scale and many more nice stuff), print that as SVG and
 then load into Inkscape for some fine-tunning.
 Maciek

v.out.svg

A module for exporting GRASS vectors was developed by Klaus Förster. The sourcecode of the module can be obtained here: http://svg.cc/grass/index.html is included in the latest GRASS release.

Convert SVG to EPS for ps.map

  • See instructions here.