Sunday, 12 June 2011

Dxf2svg in Inkscape

Dxf2svg in Inkscape


The source code is at: 
Src/extension/dxf2svg


It needs .inx files, which are needed for the kml2svg work. 

The dxf_import.inx is at ../Inkscape/share/extensions


**************Quoted Readme of Dxf2svg*****************

Readme
1.  Run make and copy dxf2svg to somewhere that is looked at by the PATH variable.  Or add the current directory to your path
2.  Copy the dxf_import.inx to ../Inkscape/share/extensions
3.  Run Inkscape
4.  Click on open or import and the dxf option should be there




KML import thoughts

Recently, I am doing code review in Inkscape and experimenting transformations for converting KML polygon path to SVG. I have studied KML and SVG files further. I made several simple KML test files to try and see the conversion process. 

My first goal is to import a simple KML file and convert it to SVG.


I am thinking to do importing a simple KML file and converting it to SVG. In Inkscape, it seems complex. I am trying to find out: 
  1. How to implement kml2svg in Inkscape, or kml import, similar to other file format import.
  2. How transformations from kml to svg is done, and what rules they have. I may need to define many things, such as canvas, origin, anchor of objects/paths, dimensions and so on. 
  3. What libraries are needed. 
I have reviewed Inkscape code base and the Java KML conversion program. I should be able to write the Java program in C++. I need to write kml-import, and thought good examples in Inkscape should be available. 

A question: 
Does anyone know kml-import is similar to which file format import? I have seen dxf2svg as an good example. But kml2svg starts with importing an XML file...

Online kml2svg convertor

I have tried and used the kml2svg converter: 
This tool is a testing version only. It is useful to try things but is not complete with limitations. 

Its Mercator projection was discussed in:


********************Quoted notes***************************


This tool converts google earth files(kml and kmz) into vectorial SVG files,
usable in Inkscape, Illustrator and other software.

kml2svg.free.fr converts most of the elements that contains a GE document:
  • folders
  • placemarks (points, lines, polygones, multigeometries and embeded images)
  • tours
  • Sketchup ressources (depending of the ressources..)
using the desired earth projection:
  • Mercator,
  • Miller,
  • Cylindrical Equal-Area (Lambert, Behrmann, Tristan Edwards, Peters, Galls, Balthasart),
  • Cylindrical Equidistant,
  • Sinusoidal,
  • Van der Grinten I,
  • Polyconic,
  • Albers Equal-Area Conic,
  • Conic Equidistant,
  • Bonne,
  • Lambert Conformal Conic,
  • Lambert Azimuthal Equal-Area,
  • Cassini


Conversion restrictions :
  • It possible to convert only file originally converted by kml2svg, otherwise it is impossible to positionate correctly the draw on the earth surface.
  • I recommand the use of INKSCAPE software to edit SVG file befor re-import.
  • Only works with MERCATOR projection at this time
  • The KML/KMZ format is mor restrictive than SVG, only few objects can be converted :
    • Text is converted in placemark
    • Lines are converted into paths.
    • Polygons and rectangles are converted into polygons
    • Groups and layers are converted into folders
    • Dash & dot lines are converted into plain line