[gdal-dev] Problem calling gdalwarp from within python script
Simon Richard Proud
srp at geo.ku.dk
Sat Jan 25 04:06:25 PST 2014
Hi,
>>I can't see any rational reason for that... Just in case : are you sure you
>>are running the same GDAL lib and binary in the terminal and from Python ?
Yes, there's only one GDAL lib installed on the system - the default one that can be installed from the Ubuntu package manager.
Anyway, I changed to use the internal gdal.ReprojectImage() commands (rather than calling gdalwarp) and those work well. So from my perspective there is no problem, although it'd be nice to know what happened in gdalwarp!
Cheers,
Simon
________________________________________
Fra: Even Rouault [even.rouault at mines-paris.org]
Sendt: 24. januar 2014 16:17
Til: gdal-dev at lists.osgeo.org
Cc: Simon Richard Proud; Sean Gillies
Emne: Re: [gdal-dev] Problem calling gdalwarp from within python script
Le vendredi 24 janvier 2014 21:46:50, Simon Richard Proud a écrit :
> Does anyone have any other ideas as to what would be causing gdalwarp to
> output entire blank images when called from a python script? I can get it
> to run using os.system and subprocess.call (using both shell=True and
> shell=False) but always just get a blank image (all pixels=0). This does
> not happen if I run exactly the same command from a terminal window.
I can't see any rational reason for that... Just in case : are you sure you
are running the same GDAL lib and binary in the terminal and from Python ?
>
> Thanks,
> Simon
>
> ________________________________________
> Fra: gdal-dev-bounces at lists.osgeo.org [gdal-dev-bounces at lists.osgeo.org]
> på vegne af Sean Gillies [sean at mapbox.com] Sendt: 20. januar 2014
> 11:56
> Til: gdal-dev at lists.osgeo.org
> Emne: Re: [gdal-dev] Problem calling gdalwarp from within python script
>
> On 1/20/14, 1:57 AM, Even Rouault wrote:
> > Selon Simon Richard Proud <srp at geo.ku.dk>:
> >> Hi,
> >> Unfortunately that produces a file not found error with filename
> >> "65535". If I remove both arguments "-srcnodata" and "65535" then I go
> >> back to getting the usage guidelines.
> >
> > You need to separate also the numerical values after -te and -tr
> >
> > ['gdalwarp','-q','-multi','-r', 'cubicspline','-t_srs', '+proj=geos
> > +lon_0=0.0 +h=35785831', '-te', '-5568748.2758', '-5568748.4774',
> > '5568748.2758', '5568748.2758','-tr', '3000.40316582', '3000.40316582',
> > '-srcnodata', '65535','TEST.tiff', 'TEST2.tiff']
>
> The shlex.split() function is handy for turning strings that you would
> have passed to os.system() into a list of args for subprocess functions.
>
> >>> import shlex
> >>> shlex.split('gdalwarp -q -multi -r cubicspline -te
>
> -5568748.2758 -5568748.4774 5568748.2758 5568748.2758')
> ['gdalwarp', '-q', '-multi', '-r', 'cubicspline', '-te',
> '-5568748.2758', '-5568748.4774', '5568748.2758', '5568748.2758']
>
> ...
>
> --
> Sean Gillies
> sean at mapbox.com
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
--
Geospatial professional services
http://even.rouault.free.fr/services.html
More information about the gdal-dev
mailing list