Re: [gdal-dev] Problem calling gdalwarp from within python script
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.roua...@mines-paris.org] Sendt: 24. januar 2014 16:17 Til: gdal-dev@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-boun...@lists.osgeo.org [gdal-dev-boun...@lists.osgeo.org] p#229; vegne af Sean Gillies [s...@mapbox.com] Sendt: 20. januar 2014 11:56 Til: gdal-dev@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 s...@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 s...@mapbox.com ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev -- Geospatial professional services http://even.rouault.free.fr/services.html ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Problem calling gdalwarp from within python script
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. Thanks, Simon Fra: gdal-dev-boun...@lists.osgeo.org [gdal-dev-boun...@lists.osgeo.org] p#229; vegne af Sean Gillies [s...@mapbox.com] Sendt: 20. januar 2014 11:56 Til: gdal-dev@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 s...@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 s...@mapbox.com ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
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-boun...@lists.osgeo.org [gdal-dev-boun...@lists.osgeo.org] p#229; vegne af Sean Gillies [s...@mapbox.com] Sendt: 20. januar 2014 11:56 Til: gdal-dev@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 s...@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 s...@mapbox.com ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev -- Geospatial professional services http://even.rouault.free.fr/services.html ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Problem calling gdalwarp from within python script
Selon Simon Richard Proud s...@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'] /Simon Fra: Kurt Schwehr [schw...@gmail.com] Sendt: 19. januar 2014 19:00 Til: Simon Richard Proud Cc: gdal-dev@lists.osgeo.org dev Emne: Re: [gdal-dev] Problem calling gdalwarp from within python script have not tested this, but I would guess something like this... ['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'] On Jan 19, 2014, at 3:13 PM, Simon Richard Proud s...@geo.ku.dk wrote: Ok, that gets things a little closer - now it gives an error: ERROR 1: Translating source or target SRS failed I tried with '+proj=geos +lon_0=0.0 +h=35785831' as one argument and as three. Same result. I also tried including the -te and -tr arguments in the one argument along with the proj details - no luck with that either. /Simon Fra: Kurt Schwehr [schw...@gmail.com] Sendt: 19. januar 2014 18:05 Til: Simon Richard Proud Cc: gdal-dev@lists.osgeo.org dev Emne: Re: [gdal-dev] Problem calling gdalwarp from within python script ,-r cubicspline, becomes -r, cubicspline, and so forth On Jan 19, 2014, at 3:00 PM, Simon Richard Proud s...@geo.ku.dk wrote: Hi, thanks for the reply. I tried changing the call to this: process.call([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]) But still receive just the usage instructions, I can't see any other arguments that can be divided into an element. Setting the shell=True option also has no effect. /Simon Fra: Kurt Schwehr [schw...@gmail.com] Sendt: 19. januar 2014 17:47 Til: Simon Richard Proud Cc: gdal-dev@lists.osgeo.org dev Emne: Re: [gdal-dev] Problem calling gdalwarp from within python script try subprocess.call([gdalwarp, -q, -multi, ... TEST2.tiff]) Each arg must be an element in the list. -kurt On Jan 19, 2014, at 2:27 PM, Simon Proud s...@geo.ku.dk wrote: Hi, I wish to call gdalwarp from within a python script but I cannot get it to work. The command I wish to run is: 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 I'm running on Ubuntu 12.04. The above command works perfectly when called from a terminal window and produces a good output image. But when I run from python I get problems. First, I tried to run with subprocess.call([gdalwarp,-q -multi ... TEST2.tiff]) then all I see is the default usage instructions. No file is created. Same if I use popen. If I use: os.system(gdalwarp -q -multi ... TEST2.tiff) then it does run and I see the expected text on the screen. However, in this case the output file is blank - it is the right size and contains the right georeferencing information but every pixel in the image has a value of zero. Does anyone have an idea what could be the problem here? Thanks! -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Problem-calling-gdalwarp-from-within-python-script-tp5098902.html Sent from the GDAL - Dev mailing list archive at Nabble.com. ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Problem calling gdalwarp from within python script
On 1/20/14, 1:57 AM, Even Rouault wrote: Selon Simon Richard Proud s...@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 s...@mapbox.com ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Problem calling gdalwarp from within python script
On Sunday 19 Jan 2014 14:27:49 Simon Proud wrote: Hi, I wish to call gdalwarp from within a python script but I cannot get it to work. The command I wish to run is: 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 You can run the command directly with: {{{ cmd = 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 Subprocess.Popen(cmd, shell=True) }}} See the doc: http://docs.python.org/2/library/subprocess.html#using-the-subprocess-module Pietro ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Problem calling gdalwarp from within python script
try subprocess.call([gdalwarp, -q, -multi, ... TEST2.tiff]) Each arg must be an element in the list. -kurt On Jan 19, 2014, at 2:27 PM, Simon Proud s...@geo.ku.dk wrote: Hi, I wish to call gdalwarp from within a python script but I cannot get it to work. The command I wish to run is: 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 I'm running on Ubuntu 12.04. The above command works perfectly when called from a terminal window and produces a good output image. But when I run from python I get problems. First, I tried to run with subprocess.call([gdalwarp,-q -multi ... TEST2.tiff]) then all I see is the default usage instructions. No file is created. Same if I use popen. If I use: os.system(gdalwarp -q -multi ... TEST2.tiff) then it does run and I see the expected text on the screen. However, in this case the output file is blank - it is the right size and contains the right georeferencing information but every pixel in the image has a value of zero. Does anyone have an idea what could be the problem here? Thanks! -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Problem-calling-gdalwarp-from-within-python-script-tp5098902.html Sent from the GDAL - Dev mailing list archive at Nabble.com. ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Problem calling gdalwarp from within python script
Hi, thanks for the reply. I tried changing the call to this: process.call([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]) But still receive just the usage instructions, I can't see any other arguments that can be divided into an element. Setting the shell=True option also has no effect. /Simon Fra: Kurt Schwehr [schw...@gmail.com] Sendt: 19. januar 2014 17:47 Til: Simon Richard Proud Cc: gdal-dev@lists.osgeo.org dev Emne: Re: [gdal-dev] Problem calling gdalwarp from within python script try subprocess.call([gdalwarp, -q, -multi, ... TEST2.tiff]) Each arg must be an element in the list. -kurt On Jan 19, 2014, at 2:27 PM, Simon Proud s...@geo.ku.dk wrote: Hi, I wish to call gdalwarp from within a python script but I cannot get it to work. The command I wish to run is: 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 I'm running on Ubuntu 12.04. The above command works perfectly when called from a terminal window and produces a good output image. But when I run from python I get problems. First, I tried to run with subprocess.call([gdalwarp,-q -multi ... TEST2.tiff]) then all I see is the default usage instructions. No file is created. Same if I use popen. If I use: os.system(gdalwarp -q -multi ... TEST2.tiff) then it does run and I see the expected text on the screen. However, in this case the output file is blank - it is the right size and contains the right georeferencing information but every pixel in the image has a value of zero. Does anyone have an idea what could be the problem here? Thanks! -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Problem-calling-gdalwarp-from-within-python-script-tp5098902.html Sent from the GDAL - Dev mailing list archive at Nabble.com. ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Problem calling gdalwarp from within python script
,-r cubicspline, becomes -r, cubicspline, and so forth On Jan 19, 2014, at 3:00 PM, Simon Richard Proud s...@geo.ku.dk wrote: Hi, thanks for the reply. I tried changing the call to this: process.call([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]) But still receive just the usage instructions, I can't see any other arguments that can be divided into an element. Setting the shell=True option also has no effect. /Simon Fra: Kurt Schwehr [schw...@gmail.com] Sendt: 19. januar 2014 17:47 Til: Simon Richard Proud Cc: gdal-dev@lists.osgeo.org dev Emne: Re: [gdal-dev] Problem calling gdalwarp from within python script try subprocess.call([gdalwarp, -q, -multi, ... TEST2.tiff]) Each arg must be an element in the list. -kurt On Jan 19, 2014, at 2:27 PM, Simon Proud s...@geo.ku.dk wrote: Hi, I wish to call gdalwarp from within a python script but I cannot get it to work. The command I wish to run is: 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 I'm running on Ubuntu 12.04. The above command works perfectly when called from a terminal window and produces a good output image. But when I run from python I get problems. First, I tried to run with subprocess.call([gdalwarp,-q -multi ... TEST2.tiff]) then all I see is the default usage instructions. No file is created. Same if I use popen. If I use: os.system(gdalwarp -q -multi ... TEST2.tiff) then it does run and I see the expected text on the screen. However, in this case the output file is blank - it is the right size and contains the right georeferencing information but every pixel in the image has a value of zero. Does anyone have an idea what could be the problem here? Thanks! -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Problem-calling-gdalwarp-from-within-python-script-tp5098902.html Sent from the GDAL - Dev mailing list archive at Nabble.com. ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Problem calling gdalwarp from within python script
Ok, that gets things a little closer - now it gives an error: ERROR 1: Translating source or target SRS failed I tried with '+proj=geos +lon_0=0.0 +h=35785831' as one argument and as three. Same result. I also tried including the -te and -tr arguments in the one argument along with the proj details - no luck with that either. /Simon Fra: Kurt Schwehr [schw...@gmail.com] Sendt: 19. januar 2014 18:05 Til: Simon Richard Proud Cc: gdal-dev@lists.osgeo.org dev Emne: Re: [gdal-dev] Problem calling gdalwarp from within python script ,-r cubicspline, becomes -r, cubicspline, and so forth On Jan 19, 2014, at 3:00 PM, Simon Richard Proud s...@geo.ku.dk wrote: Hi, thanks for the reply. I tried changing the call to this: process.call([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]) But still receive just the usage instructions, I can't see any other arguments that can be divided into an element. Setting the shell=True option also has no effect. /Simon Fra: Kurt Schwehr [schw...@gmail.com] Sendt: 19. januar 2014 17:47 Til: Simon Richard Proud Cc: gdal-dev@lists.osgeo.org dev Emne: Re: [gdal-dev] Problem calling gdalwarp from within python script try subprocess.call([gdalwarp, -q, -multi, ... TEST2.tiff]) Each arg must be an element in the list. -kurt On Jan 19, 2014, at 2:27 PM, Simon Proud s...@geo.ku.dk wrote: Hi, I wish to call gdalwarp from within a python script but I cannot get it to work. The command I wish to run is: 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 I'm running on Ubuntu 12.04. The above command works perfectly when called from a terminal window and produces a good output image. But when I run from python I get problems. First, I tried to run with subprocess.call([gdalwarp,-q -multi ... TEST2.tiff]) then all I see is the default usage instructions. No file is created. Same if I use popen. If I use: os.system(gdalwarp -q -multi ... TEST2.tiff) then it does run and I see the expected text on the screen. However, in this case the output file is blank - it is the right size and contains the right georeferencing information but every pixel in the image has a value of zero. Does anyone have an idea what could be the problem here? Thanks! -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Problem-calling-gdalwarp-from-within-python-script-tp5098902.html Sent from the GDAL - Dev mailing list archive at Nabble.com. ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Problem calling gdalwarp from within python script
have not tested this, but I would guess something like this... ['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'] On Jan 19, 2014, at 3:13 PM, Simon Richard Proud s...@geo.ku.dk wrote: Ok, that gets things a little closer - now it gives an error: ERROR 1: Translating source or target SRS failed I tried with '+proj=geos +lon_0=0.0 +h=35785831' as one argument and as three. Same result. I also tried including the -te and -tr arguments in the one argument along with the proj details - no luck with that either. /Simon Fra: Kurt Schwehr [schw...@gmail.com] Sendt: 19. januar 2014 18:05 Til: Simon Richard Proud Cc: gdal-dev@lists.osgeo.org dev Emne: Re: [gdal-dev] Problem calling gdalwarp from within python script ,-r cubicspline, becomes -r, cubicspline, and so forth On Jan 19, 2014, at 3:00 PM, Simon Richard Proud s...@geo.ku.dk wrote: Hi, thanks for the reply. I tried changing the call to this: process.call([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]) But still receive just the usage instructions, I can't see any other arguments that can be divided into an element. Setting the shell=True option also has no effect. /Simon Fra: Kurt Schwehr [schw...@gmail.com] Sendt: 19. januar 2014 17:47 Til: Simon Richard Proud Cc: gdal-dev@lists.osgeo.org dev Emne: Re: [gdal-dev] Problem calling gdalwarp from within python script try subprocess.call([gdalwarp, -q, -multi, ... TEST2.tiff]) Each arg must be an element in the list. -kurt On Jan 19, 2014, at 2:27 PM, Simon Proud s...@geo.ku.dk wrote: Hi, I wish to call gdalwarp from within a python script but I cannot get it to work. The command I wish to run is: 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 I'm running on Ubuntu 12.04. The above command works perfectly when called from a terminal window and produces a good output image. But when I run from python I get problems. First, I tried to run with subprocess.call([gdalwarp,-q -multi ... TEST2.tiff]) then all I see is the default usage instructions. No file is created. Same if I use popen. If I use: os.system(gdalwarp -q -multi ... TEST2.tiff) then it does run and I see the expected text on the screen. However, in this case the output file is blank - it is the right size and contains the right georeferencing information but every pixel in the image has a value of zero. Does anyone have an idea what could be the problem here? Thanks! -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Problem-calling-gdalwarp-from-within-python-script-tp5098902.html Sent from the GDAL - Dev mailing list archive at Nabble.com. ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Problem calling gdalwarp from within python script
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. /Simon Fra: Kurt Schwehr [schw...@gmail.com] Sendt: 19. januar 2014 19:00 Til: Simon Richard Proud Cc: gdal-dev@lists.osgeo.org dev Emne: Re: [gdal-dev] Problem calling gdalwarp from within python script have not tested this, but I would guess something like this... ['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'] On Jan 19, 2014, at 3:13 PM, Simon Richard Proud s...@geo.ku.dk wrote: Ok, that gets things a little closer - now it gives an error: ERROR 1: Translating source or target SRS failed I tried with '+proj=geos +lon_0=0.0 +h=35785831' as one argument and as three. Same result. I also tried including the -te and -tr arguments in the one argument along with the proj details - no luck with that either. /Simon Fra: Kurt Schwehr [schw...@gmail.com] Sendt: 19. januar 2014 18:05 Til: Simon Richard Proud Cc: gdal-dev@lists.osgeo.org dev Emne: Re: [gdal-dev] Problem calling gdalwarp from within python script ,-r cubicspline, becomes -r, cubicspline, and so forth On Jan 19, 2014, at 3:00 PM, Simon Richard Proud s...@geo.ku.dk wrote: Hi, thanks for the reply. I tried changing the call to this: process.call([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]) But still receive just the usage instructions, I can't see any other arguments that can be divided into an element. Setting the shell=True option also has no effect. /Simon Fra: Kurt Schwehr [schw...@gmail.com] Sendt: 19. januar 2014 17:47 Til: Simon Richard Proud Cc: gdal-dev@lists.osgeo.org dev Emne: Re: [gdal-dev] Problem calling gdalwarp from within python script try subprocess.call([gdalwarp, -q, -multi, ... TEST2.tiff]) Each arg must be an element in the list. -kurt On Jan 19, 2014, at 2:27 PM, Simon Proud s...@geo.ku.dk wrote: Hi, I wish to call gdalwarp from within a python script but I cannot get it to work. The command I wish to run is: 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 I'm running on Ubuntu 12.04. The above command works perfectly when called from a terminal window and produces a good output image. But when I run from python I get problems. First, I tried to run with subprocess.call([gdalwarp,-q -multi ... TEST2.tiff]) then all I see is the default usage instructions. No file is created. Same if I use popen. If I use: os.system(gdalwarp -q -multi ... TEST2.tiff) then it does run and I see the expected text on the screen. However, in this case the output file is blank - it is the right size and contains the right georeferencing information but every pixel in the image has a value of zero. Does anyone have an idea what could be the problem here? Thanks! -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Problem-calling-gdalwarp-from-within-python-script-tp5098902.html Sent from the GDAL - Dev mailing list archive at Nabble.com. ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Problem with gdalwarp
I am attempting to crop a geo tiff that I reprojected .. But I keep getting the error I cannot make an image that is 0x0 gdalinfo of the geotif Driver: GTiff/GeoTIFF Files: na_regionals.tif Size is 13738, 9740 Coordinate System is: PROJCS[unnamed, GEOGCS[WGS 84, DATUM[unknown, SPHEROID[WGS84,6378137,298.257223563]], PRIMEM[Greenwich,0], UNIT[degree,0.0174532925199433]], PROJECTION[Lambert_Conformal_Conic_2SP], PARAMETER[standard_parallel_1,25], PARAMETER[standard_parallel_2,25], PARAMETER[latitude_of_origin,36.5], PARAMETER[central_meridian,-95], PARAMETER[false_easting,0], PARAMETER[false_northing,0], UNIT[metre,1, AUTHORITY[EPSG,9001]]] Origin = (-8824126.437603076919913,8459741.486810354515910) Pixel Size = (1109.003596911612931,-1109.003596911612931) Metadata: AREA_OR_POINT=Area Image Structure Metadata: INTERLEAVE=PIXEL Corner Coordinates: Upper Left (-8824126.438, 8459741.487) (109d 0'29.50E, 58d50' 2.53N) Lower Left (-8824126.438,-2341953.547) (168d 6'52.48W, 5d12'19.39S) Upper Right ( 6411364.977, 8459741.487) ( 43d12'43.71E, 72d27'51.59N) Lower Right ( 6411364.977,-2341953.547) ( 39d23'29.30W, 3d51'28.79N) Center (-1206380.730, 3058893.970) (112d24'29.73W, 60d35' 2.20N) Band 1 Block=13738x1 Type=Byte, ColorInterp=Red Band 2 Block=13738x1 Type=Byte, ColorInterp=Green Band 3 Block=13738x1 Type=Byte, ColorInterp=Blue my gdalwarp command to crop gdalwarp -te -119.045 57.455 -73.818 10.284 na_regionals.tif conus_lcc.tif and the error Creating output file that is 0P x 0L. ERROR 1: Attempt to create 0x0 dataset is illegal,sizes must be larger than zero. what am I doing wrong version info GDAL 1.8.0, released 2011/01/12 -Jeff Lake MichiganWxSystem.com WeatherMichigan.net TheWeatherCenter.net GRLevelXStuff.com ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Problem with gdalwarp
Jeff, The coordinates you are using with -te are not in the coordinate system of the image. From the docs -te xmin ymin xmax ymax:set georeferenced extents of output file to be created (in target SRS). Convert the lat/lon coordinates you are using to the srs of the image and then try it. Mike -- Michael Smith US Army Corps Remote Sensing GIS/Center On 7/8/12 4:01 PM, Jeff Lake ad...@michiganwxsystem.com wrote: I am attempting to crop a geo tiff that I reprojected .. But I keep getting the error I cannot make an image that is 0x0 gdalinfo of the geotif Driver: GTiff/GeoTIFF Files: na_regionals.tif Size is 13738, 9740 Coordinate System is: PROJCS[unnamed, GEOGCS[WGS 84, DATUM[unknown, SPHEROID[WGS84,6378137,298.257223563]], PRIMEM[Greenwich,0], UNIT[degree,0.0174532925199433]], PROJECTION[Lambert_Conformal_Conic_2SP], PARAMETER[standard_parallel_1,25], PARAMETER[standard_parallel_2,25], PARAMETER[latitude_of_origin,36.5], PARAMETER[central_meridian,-95], PARAMETER[false_easting,0], PARAMETER[false_northing,0], UNIT[metre,1, AUTHORITY[EPSG,9001]]] Origin = (-8824126.437603076919913,8459741.486810354515910) Pixel Size = (1109.003596911612931,-1109.003596911612931) Metadata: AREA_OR_POINT=Area Image Structure Metadata: INTERLEAVE=PIXEL Corner Coordinates: Upper Left (-8824126.438, 8459741.487) (109d 0'29.50E, 58d50' 2.53N) Lower Left (-8824126.438,-2341953.547) (168d 6'52.48W, 5d12'19.39S) Upper Right ( 6411364.977, 8459741.487) ( 43d12'43.71E, 72d27'51.59N) Lower Right ( 6411364.977,-2341953.547) ( 39d23'29.30W, 3d51'28.79N) Center (-1206380.730, 3058893.970) (112d24'29.73W, 60d35' 2.20N) Band 1 Block=13738x1 Type=Byte, ColorInterp=Red Band 2 Block=13738x1 Type=Byte, ColorInterp=Green Band 3 Block=13738x1 Type=Byte, ColorInterp=Blue my gdalwarp command to crop gdalwarp -te -119.045 57.455 -73.818 10.284 na_regionals.tif conus_lcc.tif and the error Creating output file that is 0P x 0L. ERROR 1: Attempt to create 0x0 dataset is illegal,sizes must be larger than zero. what am I doing wrong version info GDAL 1.8.0, released 2011/01/12 -Jeff Lake MichiganWxSystem.com WeatherMichigan.net TheWeatherCenter.net GRLevelXStuff.com ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Problem with gdalwarp and resampling_method
Hi Jan, There is a simple TYPO in your commands: -s_src EPSG:25832 -t_src EPSG:31468 you should use: -s_srs EPSG:25832 -t_srs EPSG:31468 Note the last char for the referencing options, is an s instead of a c. Then -s_srs instead of -s_src and -t_srs instead of -t_src :) Hope this helps :) Daniele On Fri, Jan 14, 2011 at 4:04 PM, Jan Tappenbeck tappenb...@widemann.dewrote: HI ! i will translate a tif-image between two systems and use following command gdalwarp -s_src EPSG:25832 -t_src EPSG:31468 D:\\Orthophotos\2616_5806_RGB.tif D:\\Orthophotos\2616_5806_RGB_GK.tif then i get following message... Usage: gdalwarp [--help-general] [--formats] [-s_srs srs_def] [-t_srs srs_def] [-to NAME=VALUE] [-order n] [-tps] [-rpc] [-geoloc] [-et err_threshold] [-te xmin ymin xmax ymax] [-tr xres yres] [-ts width height] [-wo NAME=VALUE] [-ot Byte/Int16/...] [-wt Byte/Int16] [-srcnodata value [value...]] [-dstnodata value [value...]] -dstalpha [-r resampling_method] [-wm memory_in_mb] [-multi] [-q] [-cutline datasource] [-cl layer] [-cwhere expression] [-csql statement] [-cblend dist_in_pixels] [-of format] [-co NAME=VALUE]* srcfile* dstfile Available resampling methods: near (default), bilinear, cubic, cubicspline, lanczos. when i modify the command to gdalwarp -s_src EPSG:25832 -t_src EPSG:31468 -r near D:\\Orthophot ... or gdalwarp -s_src EPSG:25832 -t_src EPSG:31468 -r bilinear D:\\Orthophot ... or gdalwarp -s_src EPSG:25832 -t_src EPSG:31468 -r cubic D:\\Orthophot ... or gdalwarp -s_src EPSG:25832 -t_src EPSG:31468 -r cubicspline D:\\Orthophot ... or gdalwarp -s_src EPSG:25832 -t_src EPSG:31468 -r lanczos D:\\Orthophot ... it resonse the same message and nothing will happen! the image-informations are... C:\Program Files (x86)\FWTools2.4.7gdalinfo D:\\Orthophotos\2616_5806_ RGB.tif Driver: GTiff/GeoTIFF Files: D:\Wolfsburg\Orthophotos\2616_5806_RGB.tif D:\Wolfsburg\Orthophotos\2616_5806_RGB.tfw Size is 1, 1 Coordinate System is `' Origin = (616000.000,5807000.000) Pixel Size = (0.100,-0.100) Metadata: TIFFTAG_SOFTWARE=IrfanView TIFFTAG_XRESOLUTION=0 TIFFTAG_YRESOLUTION=0 TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch) Image Structure Metadata: INTERLEAVE=PIXEL Corner Coordinates: Upper Left ( 616000.000, 5807000.000) Lower Left ( 616000.000, 5806000.000) Upper Right ( 617000.000, 5807000.000) Lower Right ( 617000.000, 5806000.000) Center ( 616500.000, 5806500.000) Band 1 Block=1x1 Type=Byte, ColorInterp=Red Band 2 Block=1x1 Type=Byte, ColorInterp=Green Band 3 Block=1x1 Type=Byte, ColorInterp=Blue regards Jan :-) ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev -- --- Ing. Daniele Romagnoli Software Engineer GeoSolutions S.A.S. Via Poggio alle Viti 1187 55054 Massarosa (LU) Italy phone: +39 0584962313 fax: +39 0584962313 mob: +39 328 0559267 http://www.geo-solutions.it http://geo-solutions.blogspot.com/ --- ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Problem using gdalwarp to reproject Lambert Conformal Conic (LCC) to longlat
On 11-01-07 04:18 PM, James Hiebert wrote: All, Below is a question/probelm from one of my co-workers (who doesn't (yet) want to subscribe to the list). ~James Hiebert From: Hailey Eckstrandhail...@uvic.ca Date: Fri, 7 Jan 2011 13:05:10 -0800 Hello all, I am trying to reproject a geotif using gdalwarp: gdalwarp -t_srs +proj=longlat -s_srs +proj=lcc +lat_0=47.5 +lat_1=30.0 +y_0=320.0 +lat_2=60.0 +x_0=3825000.0 +lon_0=-97.0 +a=637 -r bilinear -srcnodata 1e20 -dstnodata 1e20 -tr 0.5 0.5 -te -137.812943839532 33.8985446218588 -102.312943839532 63.3985446218588 mm5i-lcc.tif mm5i-latlong.tif ERROR 1: Translating source or target SRS failed: +proj=lcc +lat_0=47.5 +lat_1=30.0 +y_0=320.0 +lat_2=60.0 +x_0=3825000.0 +lon_0=-97.0 +a=637 When I use the proj/invproj unix command, it works fine: invproj +proj=lcc +lat_0=47.5 +lat_1=30.0 +y_0=320.0 +lat_2=60.0 +x_0=3825000.0 +lon_0=-97.0 +a=637 EOF James, I would suggest you collegue be more explicit about the earth models. PROJ.4 definitions passed to GDAL utility are parsed by GDAL, converted to WKT, and then later converted back to PROJ.4 format and so not all definitions supported by PROJ.4 are necessarily supported by GDAL. In this case I suspect GDAL is confused by the lack of a +b value for the lcc projection. It may also not handle a missing earth model on the geographic coordinate system well. Best regards, -- ---+-- I set the clouds in motion - turn up | Frank Warmerdam, warmer...@pobox.com light and sound - activate the windows | http://pobox.com/~warmerdam and watch the world go round - Rush| Geospatial Programmer for Rent ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Problem using gdalwarp to reproject Lambert Conformal Conic (LCC) to longlat
On 01/07/11 22:18, James Hiebert wrote: I am trying to reproject a geotif using gdalwarp: gdalwarp -t_srs +proj=longlat -s_srs +proj=lcc +lat_0=47.5 +lat_1=30.0 +y_0=320.0 +lat_2=60.0 +x_0=3825000.0 +lon_0=-97.0 +a=637 -r bilinear -srcnodata 1e20 -dstnodata 1e20 -tr 0.5 0.5 -te -137.812943839532 33.8985446218588 -102.312943839532 63.3985446218588 mm5i-lcc.tif mm5i-latlong.tif ERROR 1: Translating source or target SRS failed: +proj=lcc +lat_0=47.5 +lat_1=30.0 +y_0=320.0 +lat_2=60.0 +x_0=3825000.0 +lon_0=-97.0 +a=637 Hi, Your SRS definition is incomplete, because you haven't defined completely the ellispoid. Try to add one of the +b, +rf , +f, +e or +es parameters, and it should work. Jean-Claude ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Problem using gdalwarp to reproject Lambert Conformal Conic (LCC) to longlat
Thanks for the quick response. It was definitely the missing +b. It seems that proj will fill in the +b with the same value if +a is given. Adding +b to the s_srs flag did the trick. ~James On Fri, Jan 07, 2011 at 04:51:05PM -0500, Frank Warmerdam wrote: On 11-01-07 04:18 PM, James Hiebert wrote: All, Below is a question/probelm from one of my co-workers (who doesn't (yet) want to subscribe to the list). ~James Hiebert From: Hailey Eckstrandhail...@uvic.ca Date: Fri, 7 Jan 2011 13:05:10 -0800 Hello all, I am trying to reproject a geotif using gdalwarp: gdalwarp -t_srs +proj=longlat -s_srs +proj=lcc +lat_0=47.5 +lat_1=30.0 +y_0=320.0 +lat_2=60.0 +x_0=3825000.0 +lon_0=-97.0 +a=637 -r bilinear -srcnodata 1e20 -dstnodata 1e20 -tr 0.5 0.5 -te -137.812943839532 33.8985446218588 -102.312943839532 63.3985446218588 mm5i-lcc.tif mm5i-latlong.tif ERROR 1: Translating source or target SRS failed: +proj=lcc +lat_0=47.5 +lat_1=30.0 +y_0=320.0 +lat_2=60.0 +x_0=3825000.0 +lon_0=-97.0 +a=637 When I use the proj/invproj unix command, it works fine: invproj +proj=lcc +lat_0=47.5 +lat_1=30.0 +y_0=320.0 +lat_2=60.0 +x_0=3825000.0 +lon_0=-97.0 +a=637 EOF James, I would suggest you collegue be more explicit about the earth models. PROJ.4 definitions passed to GDAL utility are parsed by GDAL, converted to WKT, and then later converted back to PROJ.4 format and so not all definitions supported by PROJ.4 are necessarily supported by GDAL. In this case I suspect GDAL is confused by the lack of a +b value for the lcc projection. It may also not handle a missing earth model on the geographic coordinate system well. Best regards, -- ---+-- I set the clouds in motion - turn up | Frank Warmerdam, warmer...@pobox.com light and sound - activate the windows | http://pobox.com/~warmerdam and watch the world go round - Rush| Geospatial Programmer for Rent ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev -- James Hiebert Lead, Computational Support Pacific Climate Impacts Consortium http://www.pacificclimate.org C178 Segdewick Building, University of Victoria PO Box 1700 Sta CSC, Victoria, BC V8V 2Y2 E-mail: hieb...@uvic.ca Tel: (250) 472-4521 Fax: (250) 472-4830 ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] problem with gdalwarp in 1.7
Seth, You can obtain the WKT of the geometries in a vector data source by using ogrinfo with the -al option. (http://www.gdal.org/ogrinfo.html) On Sun, Nov 21, 2010 at 6:20 PM, geographika geograph...@gmail.com wrote: On 19/11/2010 18:04, Frank Warmerdam wrote: geographika wrote: Hi, I have upgraded from GDAL 1.6 (32bit Windows) to 1.7 (64 bit Windows) and the following command no longer works: C:\mapserver\bin\gdal\apps\gdalwarp C:\Data\Rasters\MiscSuit.tif C:\RasterClips\mytest.tif -cutline c:\RasterClips\hello.json -te 118008.672141 177232.164284 138695.761666 206164.398565 -dstnodata - I get the following message in the command prompt: Creating output file that is 414P x 579L. Processing input file C:\Data\Rasters\MiscSuit.tif. for band 1, destination nodata value has been clamped to 0, the original value being out of range. ERROR 1: Failed to parse CUTLINE geometry wkt. The CUTLINE is valid GeoJSON (but would clearly be invalid WKT) and produces the correct results in 1.6. The ogr formats lists GeoJSON as read/write. I am using 64-bit builds of GDAL taken from http://vbkto.dyndns.org/sdk/ I have also tried using the development version of GDAL 1.8dev but get the same message. If I do not use a CUTLINE the gdalwarp completes successfully but the new image does not contain any data from my original image (all cells are NoData). Seth, Can you make the .json file available? Does it work with OGR? Try ogrinfo on it. Hmm, tracking through the code the LoadCutline() function in gdalwarp.cpp will read from the OGR datasource and convert the geometry to WKT which is attached to the cutline property of the warp. Later GDALWarpOperation:: Initialize() turns that into a polygon object and that is where the message is coming from. So I am *suspecting* improper WKT of some type is getting produced somehow. We will really need to see the WKT that is causing the error to know more. If you are comfortable rebuilding things then try changing: const char *pszCutlineWKT = CSLFetchNameValue( psOptions-papszWarpOptions, CUTLINE ); if( pszCutlineWKT ) { in the file gdal/alg/gdalwarpoperation.cpp to something like: const char *pszCutlineWKT = CSLFetchNameValue( psOptions-papszWarpOptions, CUTLINE ); if( pszCutlineWKT ) { printf( WKT = %s\n, pszCutlineWKT ); Best regards, Thanks very much for your reply Frank. I have uploaded the GeoJSON to http://geographika.co.uk/downloads/test.json Running ogrinfo C:\test.json on the file produces the following results: ERROR 4: GeoJSON Driver doesn't support update. Had to open data source read-only. INFO: Open of `C:\RasterClips\hello.json' using driver `GeoJSON' successful. 1: OGRGeoJSON (Polygon) Is it possible to use the ogr2ogr to convert GeoJSON to WKT to check if this is successful? WKT is not in the list of formats at http://www.gdal.org/ogr/ogr_formats.html Compiling a 64bit version of GDAL is on my list of things to learn, so I will try your second suggestion then. The gdalwarp with the same GeoJSON works in 1.6 but it does throw up the warning that: the source raster dataset and the input vector layer do not have the same SRS. Results will be probably incorrect. Regards, Seth ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev -- Best regards, Chaitanya kumar CH. /tʃaɪθənjə/ /kʊmɑr/ +91-9494447584 17.2416N 80.1426E ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] problem with gdalwarp in 1.7 - SOLVED
Thanks to both Frank and Chaitanya this is now resolved. Adding in the coordinate system to my GeoJSON solved the issue in the latest versions of GDAL. Leaving this out did not produce errors using ogrinfo, but it did not display the feature as WKT until the CRS was added in. { type: Polygon, *crs: { type: EPSG, properties: { code: 29902 } },* coordinates: [ [ [ 123608.61199436858, 206164.3985653462 ], [ On 21/11/2010 15:38, Chaitanya kumar CH wrote: Seth, You can obtain the WKT of the geometries in a vector data source by using ogrinfo with the -al option. (http://www.gdal.org/ogrinfo.html) On Sun, Nov 21, 2010 at 6:20 PM, geographika geograph...@gmail.com mailto:geograph...@gmail.com wrote: On 19/11/2010 18:04, Frank Warmerdam wrote: geographika wrote: Hi, I have upgraded from GDAL 1.6 (32bit Windows) to 1.7 (64 bit Windows) and the following command no longer works: C:\mapserver\bin\gdal\apps\gdalwarp C:\Data\Rasters\MiscSuit.tif C:\RasterClips\mytest.tif -cutline c:\RasterClips\hello.json -te 118008.672141 177232.164284 138695.761666 206164.398565 -dstnodata - I get the following message in the command prompt: Creating output file that is 414P x 579L. Processing input file C:\Data\Rasters\MiscSuit.tif. for band 1, destination nodata value has been clamped to 0, the original value being out of range. ERROR 1: Failed to parse CUTLINE geometry wkt. The CUTLINE is valid GeoJSON (but would clearly be invalid WKT) and produces the correct results in 1.6. The ogr formats lists GeoJSON as read/write. I am using 64-bit builds of GDAL taken from http://vbkto.dyndns.org/sdk/ I have also tried using the development version of GDAL 1.8dev but get the same message. If I do not use a CUTLINE the gdalwarp completes successfully but the new image does not contain any data from my original image (all cells are NoData). Seth, Can you make the .json file available? Does it work with OGR? Try ogrinfo on it. Hmm, tracking through the code the LoadCutline() function in gdalwarp.cpp will read from the OGR datasource and convert the geometry to WKT which is attached to the cutline property of the warp. Later GDALWarpOperation:: Initialize() turns that into a polygon object and that is where the message is coming from. So I am *suspecting* improper WKT of some type is getting produced somehow. We will really need to see the WKT that is causing the error to know more. If you are comfortable rebuilding things then try changing: const char *pszCutlineWKT = CSLFetchNameValue( psOptions-papszWarpOptions, CUTLINE ); if( pszCutlineWKT ) { in the file gdal/alg/gdalwarpoperation.cpp to something like: const char *pszCutlineWKT = CSLFetchNameValue( psOptions-papszWarpOptions, CUTLINE ); if( pszCutlineWKT ) { printf( WKT = %s\n, pszCutlineWKT ); Best regards, Thanks very much for your reply Frank. I have uploaded the GeoJSON to http://geographika.co.uk/downloads/test.json Running ogrinfo C:\test.json on the file produces the following results: ERROR 4: GeoJSON Driver doesn't support update. Had to open data source read-only. INFO: Open of `C:\RasterClips\hello.json' using driver `GeoJSON' successful. 1: OGRGeoJSON (Polygon) Is it possible to use the ogr2ogr to convert GeoJSON to WKT to check if this is successful? WKT is not in the list of formats at http://www.gdal.org/ogr/ogr_formats.html Compiling a 64bit version of GDAL is on my list of things to learn, so I will try your second suggestion then. The gdalwarp with the same GeoJSON works in 1.6 but it does throw up the warning that: the source raster dataset and the input vector layer do not have the same SRS. Results will be probably incorrect. Regards, Seth ___ gdal-dev mailing list gdal-dev@lists.osgeo.org mailto:gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev -- Best regards, Chaitanya kumar CH. /tʃaɪθənjə/ /kʊmɑr/ +91-9494447584 17.2416N 80.1426E ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] problem with gdalwarp in 1.7
geographika wrote: Hi, I have upgraded from GDAL 1.6 (32bit Windows) to 1.7 (64 bit Windows) and the following command no longer works: C:\mapserver\bin\gdal\apps\gdalwarp C:\Data\Rasters\MiscSuit.tif C:\RasterClips\mytest.tif -cutline c:\RasterClips\hello.json -te 118008.672141 177232.164284 138695.761666 206164.398565 -dstnodata - I get the following message in the command prompt: Creating output file that is 414P x 579L. Processing input file C:\Data\Rasters\MiscSuit.tif. for band 1, destination nodata value has been clamped to 0, the original value being out of range. ERROR 1: Failed to parse CUTLINE geometry wkt. The CUTLINE is valid GeoJSON (but would clearly be invalid WKT) and produces the correct results in 1.6. The ogr formats lists GeoJSON as read/write. I am using 64-bit builds of GDAL taken from http://vbkto.dyndns.org/sdk/ I have also tried using the development version of GDAL 1.8dev but get the same message. If I do not use a CUTLINE the gdalwarp completes successfully but the new image does not contain any data from my original image (all cells are NoData). Seth, Can you make the .json file available? Does it work with OGR? Try ogrinfo on it. Hmm, tracking through the code the LoadCutline() function in gdalwarp.cpp will read from the OGR datasource and convert the geometry to WKT which is attached to the cutline property of the warp. Later GDALWarpOperation:: Initialize() turns that into a polygon object and that is where the message is coming from. So I am *suspecting* improper WKT of some type is getting produced somehow. We will really need to see the WKT that is causing the error to know more. If you are comfortable rebuilding things then try changing: const char *pszCutlineWKT = CSLFetchNameValue( psOptions-papszWarpOptions, CUTLINE ); if( pszCutlineWKT ) { in the file gdal/alg/gdalwarpoperation.cpp to something like: const char *pszCutlineWKT = CSLFetchNameValue( psOptions-papszWarpOptions, CUTLINE ); if( pszCutlineWKT ) { printf( WKT = %s\n, pszCutlineWKT ); Best regards, -- ---+-- I set the clouds in motion - turn up | Frank Warmerdam, warmer...@pobox.com light and sound - activate the windows | http://pobox.com/~warmerdam and watch the world go round - Rush| Geospatial Programmer for Rent ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev