TransWikia.com

TypeError when using gdal.Warp in Jupyter Notebook

Geographic Information Systems Asked on December 19, 2020

I try to use the gdal python binding to project a raster in World Mollweide.

import gdal 

map_raster_proj = pm.getTmpDir() + Path(map_raster).stem + '_proj.tif'
input_ = gdal.Open(map_raster)
gdal.Warp(input_, map_raster_proj, dstSRS='ESRI:54009')

but i get the following error :

TypeError: in method ‘wrapper_GDALWarpDestDS’, argument 4 of type ‘GDALWarpAppOptions *’

If I use gdalwarp from a terminal it runs without bug. Am I doing something wrong?

One Answer

Your input and output arguments are reversed, the function signature is:

gdal.Warp(destNameOrDestDS, srcDSOrSrcDSTab, **kwargs)

Correct answer by user2856 on December 19, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP