0

I upload in QGIS canvas 2 polygons layers: Buildings with 100432 features and Census units with 2876 features. They should be aligned and perfectly overlapped but they aren't (i.e., some buildings are beyond census units edges). So, I am trying to move all features of Buildings layer by selecting all features with a circle, activating the editing tool and then moving all of them. Unfortunately an error message of "unknown exception" is shown. While, if I do the inverse, i.e. I move the Census Units, which is less suitable solution for me, it works. [1] Do you know which is the reason? [2] I suppose that another solution could be changing the reference system, but can someone tell me, if needed, which criterion adopting for it? Thanks!

3
  • 3
    Don't mess with (official) data, if your results should be valid. That said... which CRS are the data in? How large is the discrepancy? Why do you believe that the buildings should be inside the census areas? How far temporarily apart are the data sets? – Erik Jun 7 at 16:37
  • 1
    it seems to be a classic coordinate conversion error – pigreco Jun 7 at 19:33
  • 1
    To give solid answers, it is necessary to inspect the data. Could you provide (sample) data? – Babel Jun 8 at 7:31
3

If you need to shift the input layer, you can use the QGIS processing tools and in particular Translate:

process:

  1. draw an origin point on a vertex and read the coordinates
  2. draw a second destination point and read the coordinates
  3. make the difference of the coordinates and use them in the Translate algorithm

enter image description here

enter image description here

Move vector layer based on YX (Meters)

1
  • Thanks a lot but actually in my QGIS version this tool is only for raster... – FedericaZ Jun 8 at 12:49
2

If you need only to move the input layer, you can use the great gdal/ogr

ogr2ogr output.shp input.shp -dialect sqlite -sql "SELECT fieldOne,fieldTwo,ShiftCoords(geometry,-11.869,60.133) FROM input"

-11.869,60.133 are shiftX and shiftY.

Note: fieldOne,fieldTwo are all the input fields except the geometric one

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.