[GIS] Georeferencing DWG using QGIS

dwggeopackagegeoreferencingqgis

I am using QGIS 3.4.11 on Windows 10 x64.

I have three large DWG files that are the output of a survey (each roughly 5MB). No problem to import them into QGIS as geopackages using the built in DXF/DWG import at geopackage tool under the Project menu. When I do that, the result is a Group of layers (probably 20 or so per geopackage).

Problem is that the layers are not properly georeferenced when I do that (ie they appear in the middle of the Indian Ocean).

Is there some easy way to either edit the extent property of the entire geopackage, specify the extent at import time, or to otherwise georeference the entire geopackage all at once?

I have plenty of control points, but the georeferencing tool that I use for vector files doesn't seem to work for geopackages.

Best Answer

There is a command line tool that is installed with Qgis that can shift all features. Open the command prompt and input the following:

ogr2ogr data_shifted.shp original_data.shp -dialect sqlite -sql "SELECT ShiftCoords(geometry,1,10) FROM data"

X shift = 1

Y shift = 10

Adjust those values as needed.

The above answer is from the page How to easily shift all features in a vector dataset?

I tried using the tool with geopackage layers but was unsuccessful so you will need to convert you layers to shapefiles. It can easily be done by right clicking the layer in QGIS and selecting Export -> Save features as and make sure to specify the format as ESRI Shapefile.