5

I have a shapefile with about 5000 line strings. I am translating and scaling this file using GeoPandas:

import geopandas

green = geopandas.read_file('./shapefiles/unnamed (1)_green.shp')

The translation process completes with no problem but the scaling projects wrong coordinates.

Translating:

green['geometry'].translate(510959.95011, 3935297.77119)

enter image description here

Scaling:

green['geometry'] = green['geometry'].scale(2,2,2)

enter image description here

Is there a workaround?

1 Answer 1

6

If you don't use origin parameter, a geometry is scaled from its bounding box center. Therefore, use an appropriate center coordinate for origin.

For example:

green['geometry'].scale(2, 2, origin=(510959.95011, 3935297.77119))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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