0

I would like to move a polygon's center to another location by specifying a latitude and longitude. I am using a EPSG:4326 - WGS 84 projection.

bdelliott
  • 455
  • 2
  • 9
  • 2
    Same as here? https://gis.stackexchange.com/a/392617/88814 – Babel Apr 01 '21 at 14:11
  • This posting contains two solutions. The first is a manual move to drag-and-drop. But is inaccurate to an exact position. The second, is using an expression that seems to be translating by x and y. I am not understanding how that maps to lat / long coordinates. – bdelliott Apr 01 '21 at 16:27
  • In the solution with the expression, simply replace the following part with the value of your x coordinate: x(geometry (get_feature_by_id ('points',$id))) and do the same for the y coordinate. You could also create a point layer with your coordinate values (save them as CSV, then load them to QGIS) - the you have 1:1 the same case as in the solution linked in my first comment. – Babel Apr 01 '21 at 20:21
  • I tried this and didn't have much luck. A new layer was supposedly created but I zoom to it and nothing is there. Here is the output: { 'EXPRESSION' : 'translate( \n $geometry, \n 10-\n x (centroid ($geometry)),\n y(\n geometry (\n get_feature_by_id (\n \'points\',\n $id\n )\n )\n )-\n y (centroid ($geometry))\n)', 'INPUT' : '/private/var/folders/16/nmcjxt8j1412rg5vsw_pwd3r0000gn/T/processing_hDlGND/e433a803034d4a5ba032059e6958fdcd/output.gpkg', 'OUTPUT' : 'TEMPORARY_OUTPUT', 'OUTPUT_GEOMETRY' : 0, 'WITH_M' : False, 'WITH_Z' : False } But I had better luck with the Affine Transform tool – bdelliott Apr 02 '21 at 03:02

0 Answers0