Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QGis: How to import svg or raster images into Quantum GIS?

these vector or raster files being classic files without geocoordinates. They are lat/long projection, I want to import them into QGIS, scale them up/down, place them to their right place, and they become reusable shp or raster geocoordinated layers.

Edit: I'am from the wikipedia Graphic Lab>Map workshop, we want to work more using GIS. We litteraly have hundreds maps to migrate to GIS technologies....

  • File:Chinese_plain_5c._BC-en.svg
  • File:Vignobles_basse_loire.svg

enter image description hereenter image description here

like image 312
Hugolpz Avatar asked Mar 28 '13 20:03

Hugolpz


People also ask

Can Qgis open SVG files?

It is possible to embed SVG symbols directly within a QGIS projects. Choose the layer which will support SVG symbology and open its properties dialog. Open the section Symbology in :menuselection: Properties –> Symbology .

Can SVG be raster?

The <image> SVG element includes images inside SVG documents. It can display raster image files or other SVG files. The only image formats SVG software must support are JPEG, PNG, and other SVG files.

Are SVG vector files?

What is an SVG file? Scalable Vector Graphics (SVG) is a web-friendly vector file format. As opposed to pixel-based raster files like JPEGs, vector files store images via mathematical formulas based on points and lines on a grid.


2 Answers

Partial Solution: load SVG into Inkscape, Save as DXF file, then you can load this into QGIS. This should at least get you most of the linework into QGIS.

However, it won't yet be properly georeferenced or styled, and different layers may be in different places because the SVG has some scaling and translating operators on parts of the map data that QGIS or Inkscape is ignoring. You'll probably need to work with a layer at a time. This probably isn't a problem since maybe you are only interested in the added data on the map, and not the base map (country outlines etc) since you will probably want to overlay your data onto standard map base layer (natural earth, OpenStreetMap tiles).

The only way I see to do the transformation at present is to work out the affine transformation parameters and use the QgsAffine plugin, but that does require you to work out the parameters beforehand by fitting known source coordinates to known target coordinates.

But to do hundreds? You might be better off writing some custom SVG parsing code for each one...

like image 67
Spacedman Avatar answered Oct 21 '22 15:10

Spacedman


If you only want to display it in the correct place, scale and rotation treat it as an SVG icon.
1. create a point layer and put a single point at the georeferenced centre of the SVG you will load.
2. edit the symbology and load the SVG as an icon
3. set the size units to map units
4. supply the appropriate dimensions
5. rotate as necessary

The redraw is very slow and painful, but if you use Project>import/Export>Export map as image you can make a georeferenced raster.

like image 42
Simon Allen Avatar answered Oct 21 '22 16:10

Simon Allen