3

I have more than 1000 polygons, but they do not have the correct size and location. I have a table with the correct coordinates (centroid) "x, y" and different scale factor for each polygon. How can I automatically resize them and move them all to their correct location? In QGIS I used use the plugin "Transformation Afine" for individualy polygons or scaling tool in advanced edit (ArcMap). My shapefile use EPSG: 5367 (local system CRTM05)

Fields

The batch processing does not recognize fields, only values

The batch processing does not recognize fields, only values

4
  • Does this help ? gis.stackexchange.com/questions/93031/… The link in the post is 404ed, but googling "qgis batch processing docs" returns links to 2.0 and 2.2. right at the top.
    – deg
    Aug 30 '17 at 1:45
  • No. The batch processing does not recognize fields, only values Aug 30 '17 at 2:21
  • The problem is that v.transform does not accept field names.
    – underdark
    Aug 30 '17 at 17:42
  • @underdark I need to find a solution in Arcmap, Qgis, phyton or any other GIS platform Aug 31 '17 at 1:31
2

In QGIS you can Create a Virtual Layer with a SpatiaLite expression to perform the transformation that you need:

SELECT 
  ShiftCoords(
    ScaleCoords(
      ShiftCoords(
        a.geometry,
        - X( Centroid( a.geometry)), 
        - Y( Centroid( a.geometry))
      ), 
      a.factor
    ), 
    a.x, 
    a.y
  ) AS geometry, 
  a.id AS id 
FROM scale AS a

With that query, we are:

  • Translating each polygon to the origin of coordinates by subtracting the coordinates of its centroid from all its points: ShiftCoords( a.geometry, - X( Centroid( a.geometry)), - Y( Centroid( a.geometry))).

  • Scaling each translated polygon by the factor value stored in the factor field: ScaleCoords( ..., a.factor).

  • Translating again each scaled polygon to the correct values of the x and y fields: ShiftCoords( ..., a.x, a.y).

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.