Opened 14 years ago

Closed 14 years ago

#120 closed defect (invalid)

gdal_polygonize missing

Reported by: lutra Owned by: warmerdam
Priority: major Component: Package
Version: 1.0 Keywords: pkg-gdal16
Cc:

Description

it seems that actually the installer do not install the gdal_polygonize script when choosing the gdal 1.6 version.

The lack of this tool do not allow the use of the "polygonize" tool in the "gdal tools" qgis plugin.

Change History (7)

comment:1 by warmerdam, 14 years ago

Keywords: pkg-gdal16 added
Owner: changed from osgeo4w-dev@… to warmerdam

comment:2 by warmerdam, 14 years ago

Status: newassigned

On review, it appears gdal_polygonize is being installed as part of the gdal16 package.

However, since GDAL 1.6 is not the primary GDAL version it is only put in C:\OSGeo4W\apps\gdal-16\bin which is only in the path after you run the gdal16.bat script.

I think if QGIS's gdal tools intend to run the 1.6 tools, this bin directory should be prepended to the path in some fashion for qgis.

in reply to:  2 comment:3 by lutra, 14 years ago

Hi,

However, since GDAL 1.6 is not the primary GDAL version it is only put in C:\OSGeo4W\apps\gdal-16\bin which is only in the path after you run the gdal16.bat script.

strange, I cannot find gdal_poligonize anywhere in my osgeo4w installation that includes gdal-16

comment:4 by jef, 14 years ago

Short diagnostic:

  1. The batch files used to spawn qgis call gdal16.bat
  2. gdal_polygonize(.bat) is a batch file in apps/gdal-16/bin
  3. calling gdal_polygonize from the QGIS' GRASS shell (just for the environment) gives:
    Traceback (most recent call last):
      File "C:\OSGeo4W\apps\gdal-16\bin\gdal_polygonize.py", line 34, in <module>
        import gdal, ogr, osr
      File "C:\OSGeo4W\apps\Python25\lib\site-packages\gdal.py", line 2, in <module>
    
      File "C:\OSGeo4W\apps\Python25\lib\site-packages\osgeo\gdal.py", line 7, in <module>
    ImportError: No module named _gdal
    
  4. Looks like the PYTHONPATH is messed up somehow %OSGEO4W_ROOT%\apps\gdal-16\pymod is missing. Interestingly %OSGEO4W_ROOT%\apps\gdal-16\bin is in the PATH.
  5. running gdal16.bat again prepends it to the PYTHONPATH and gdal_polygonize works.

in reply to:  4 comment:5 by jef, 14 years ago

Replying to jef:

  1. Looks like the PYTHONPATH is messed up somehow %OSGEO4W_ROOT%\apps\gdal-16\pymod is missing. Interestingly %OSGEO4W_ROOT%\apps\gdal-16\bin is in the PATH.

Hm, but import gdal works in the python console as sys.path contains %OSGEO4W_ROOT%\apps\gdal-16\pymod.

comment:6 by warmerdam, 14 years ago

I see gdal_polygonize.py and gdal_polygonize.bat in the gdal-16-python tar file. I trust this package is installed?

From the above comments it appears the problem is related to transporting the right environment to qgis on startup.

comment:7 by brushtyler, 14 years ago

Resolution: invalid
Status: assignedclosed

In OsGEO4W installation, the gdal_polygonize.bat is in the gdal-16-python package.

If the gdal-16-python package is installed, running either qgis-dev.bat (after installing the qgis-dev package) or qgis.bat (after running gdal16.bat to set env vars), the polygonize tool works fine.

Note: See TracTickets for help on using tickets.