Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gdal Tools Merge tool fails to read extents #13152

Closed
qgib opened this issue Oct 7, 2010 · 1 comment
Closed

Gdal Tools Merge tool fails to read extents #13152

qgib opened this issue Oct 7, 2010 · 1 comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Plugins
Milestone

Comments

@qgib
Copy link
Contributor

qgib commented Oct 7, 2010

Author Name: sowelu - (sowelu -)
Original Redmine Issue: 3092

Redmine category:python_plugins
Assignee: Giuseppe Sucameli


Using GDAL Tools, Warp tool I was getting a Python message that an index was out of range. The problem was in this code in doMerge.py where indicated

    info = QString( arr ).split( "\
" )
    ulCoord = info[ info.indexOf( QRegExp( "^Upper\\sLeft.*" ) ) ].simplified()
    lrCoord = info[ info.indexOf( QRegExp( "^Lower\\sRight.*" ) ) ].simplified()
    ul = ulCoord.split( " " )
    lr = lrCoord.split( " " )
    xUL = ul[ 3 ].replace( ",", "" ).toDouble() [ 0 ]  <--- Index error
    yUL = ul[ 4 ].replace( ")", "" ).toDouble()[ 0 ]
    xLR = lr[ 3 ].replace( ",", "" ).toDouble()[ 0 ]
    yLR = lr[ 4 ].replace( ")", "" ).toDouble()[ 0 ]


This resulted from a raster with the following partial gdalinfo

Upper Left  (13631210.192,-3336272.678)
Lower Left  (13631210.192,-3348502.603)
Upper Right (13643440.117,-3336272.678)
Lower Right (13643440.117,-3348502.603)
Center      (13637325.154,-3342387.640)

It appears as though the ulCoord string is not being split properly on spaces, because the spaces do not exist around the comma and bracket. I am compiling QGIS with GDAL trunk (on Linux), so maybe the format has changed.

The code below fixed the problem and might be more robust (although I am not very good at python).

    info = QString( arr ).split( "\
" )
    ulCoord = info[ info.indexOf( QRegExp( "^Upper\\sLeft.*" ) ) ].simplified()
    lrCoord = info[ info.indexOf( QRegExp( "^Lower\\sRight.*" ) ) ].simplified()
    xUL = ulCoord[ulCoord.indexOf( "(" ) + 1 : ulCoord.indexOf( "," ) - 1].toDouble()r0
    yUL = ulCoord[ulCoord.indexOf( "," ) + 1 : ulCoord.indexOf( ")" ) - 1].toDouble()r0
    xLR = lrCoord[lrCoord.indexOf( "(" ) + 1 : lrCoord.indexOf( "," ) - 1].toDouble()r0
    yLR = lrCoord[lrCoord.indexOf( "," ) + 1 : lrCoord.indexOf( ")" ) - 1].toDouble()r0

Roland

@qgib
Copy link
Contributor Author

qgib commented Nov 5, 2010

Author Name: Giuseppe Sucameli (@brushtyler)


Replying to "sowelu":/issues/show/3092:

Using GDAL Tools, Warp tool I was getting a Python message that an index was out of range.
Did you mean Merge tool, isn't it?

Fixed from 838b614 (SVN r14514)


  • resolution was configured as fixed
  • status_id was changed from Open to Closed

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Plugins labels May 24, 2019
@qgib qgib added this to the Version 1.6.0 milestone May 24, 2019
@qgib qgib closed this as completed May 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Plugins
Projects
None yet
Development

No branches or pull requests

1 participant