0

I am trying to reproject and resize an image in QGIS python console. But i am getting invalid syntax error.

import gdal
fn = "D:\\satellite\\1.tif"
out = "D:\\1.tif"
gdal Warp(out,fn,srcSRS ="EPSG : 4326",dstSRS = "EPSG : 32614",width = 3400,height = 3400))

What seems to be wrong here?

1 Answer 1

1

You actually have a few syntax errors. Firstly, you need to use dot notation to call the Warp function e.g. gdal.Warp().

Secondly, you have a space before the colons in your epsg code strings.

Lastly you have an extra closing parenthesis.

Try:

import gdal
fn = "D:\\satellite\\1.tif"
out = "D:\\1.tif"
gdal.Warp(out, fn, srcSRS = "EPSG: 4326", dstSRS = "EPSG: 32614", width = 3400, height = 3400)

Your Answer

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

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