I have got myself a dxf which is built with units in the wrong scale. How do I upscale that in QGIS? Note it does open in QGIS, just in the wrong map units and location.
-
nhopton's answer above on using the qgsAffine plugin worked for me only last week. I had a dxf that was scaled 1000x the CRS I wanted. I transformed the dxf to shp with the standard plugin, then transformed X and Y by multiplying by .001 in qgsAffine, and problem was solved. PS Belated thanks to nhopton for the advice, which I didn't get to extend before the QGIS Forum was shut down!– blackthornCommented Apr 3, 2012 at 12:36
-
I also have a few DXFs that I wish to affine. I used OpenJump once, because I could not do the maths for the QGIS plugin. However, eventually I found it easier to save my SHP layer with a known projection as a DXF, open this in (free) QCAD, import the DXF which needed affining, and do all the scaling, rotating and moving of the DXF there. When everything was in place I then saved it as a DXF and re-imported it into QGIS where the projection was retained and my DXF was now also affined in the proper position and scale. I could then save the DXF as SHP.– MelissaCommented Jun 4, 2015 at 10:14
7 Answers
Another - more interactive - option is the Vector Bender plugin. It
does to vectors what georefencers does to raster. This feature is also known as "rubber sheeting".
There is even a video showcasing how it works: https://vimeo.com/96142479
You georeference rasters and affine vectors :)
QGIS has an affine plug-in (qgsAffine) with which you can scale vector layers. You can also apply x and y offsets to all of the vertices in a vector layer if required. I think you will probably need to convert your DXF to a shapefile to use it though (right-click on the layer in the layers panel and go 'Save as...'). Applying rotation to a vector layer is slightly more difficult.
-
1Here are some tips to rotating with qgsAffine: gis.stackexchange.com/q/21696/1872– Mike TCommented Apr 2, 2012 at 21:37
-
Hum yes, I did make a contribution to that topic which didn't seem to find much favour. But on balance I still prefer the OpenJump approach, it calculates all seven transformation parameters and then applies them to the vector of interest. I think I saw a QGIS GSoC proposal for doing the same thing in QGIS, which would be helpful.– nhoptonCommented Apr 3, 2012 at 7:49
-
Yeah, I see what the OpenJump folks are using and it is much slicker!– Mike TCommented Apr 3, 2012 at 8:22
I believe this can be accomplished in QGIS .
However I use cad software with my gis software and would do the following in it.
Either way you need some basic information about the dxf.
1. You should know the units of the dxf.
2. You should have a set of known points in the dxf. (at the very least 2 points).
1a. If the original coordinate system (or non-system) is identifiable then you should transform it to a similar known system.
(if the drawing was just drawn in no system but a 0,0 base system assume some type of equal area.) either alambert or albers (dependent upon the coverage area [size])
2a. ensure that all items in the drawing are displayed (no layers turned off).
3a. select all the features.
4a. move all the features from a known point to a known point.
5a. after determining the original scale resize all selected objects empirically
6a. rotate all selected objects empirically.
Save and/or export the selected objects with a known CRS.
The Plugin AnotherDXF2Shape contains a Georeferencing modul:
By means of X and Y offset, a simple displacement of the DXF can be achieved. This is y.B. useful when the original coordinates have been shortened in the CAD / system.
World files for CAD datasets
A world (.wld) file is a text file containing control points that describe a coordinate transformation. A world file can be used to extend the properties of a CAD drawing to include georeferencing information. The information is stored as coordinate values that define one or two displacement vectors called links. The data comprises two or four pairs of coordinates organized into two rows. Each row defines a displacement link using the following syntax: . The first pair of coordinates in each row corresponds to the source coordinates, also known as the from-coordinates. These values represent the x,y location of any known control point in the CAD drawing. The second pair of coordinates in each row corresponds to the destination coordinates, also known as the to-coordinates. These values represent a new location in geographic space, typically a reference point in another feature layer. Source: arcgis.com
If the coordinate transformation is activated and the plug-in finds a corresponding WLD-file it is automatically integrated and the DXF file is transformed accordingly.
Transformation over 1-4 identical points
Similar to the CAD data set, a transformation takes place via identical points. The number of parameters for the transformation depends on the number of the given points. Note: An output of the residuals for over-determination is currently not.
This can also be done using GDAL 1.10. The approach uses control points, and is less about just scaling, but full on georeferencing (handy if the dxf has lost all of its spatial information).
It is done by performing a basic transformation in ogr2ogr and supplying the control points in the -gcp tag. http://www.gdal.org/ogr2ogr.html
For a guide please see: Georeferencing vector data using QGIS
I used OpenJump once, because I could not do the maths for the QGIS plugin. However, eventually I found it easier to save my SHP layer with a known projection as a DXF, open this in (free) QCAD, import the DXF which needed affining, and do all the scaling, rotating and moving of the DXF there. When everything was in place I then saved it as a DXF and re-imported it into QGIS where the projection was retained and my DXF was now also affined in the proper position and scale. I could then save the DXF as SHP.
The fastest way, I think, is to modify your DXF file (scale and place in right coordinates) using a CAD software, and then load it in QGIS.
You can, of course, move your features in QGIS, but you can not scale them. Hope this helps.