polygoniseRaster2VecLyr() problem

44 views
Skip to first unread message

Vincenzo Fiozzo

unread,
Nov 11, 2019, 5:44:50 AM11/11/19
to RSGISLib Support
Hi y'all, I recently raised the same question here, too (https://github.com/ashutoshkumarjha/rsgislib/issues/1), I'd like to ask you now how I can fix my problem.

I'm trying to extract poligons with pixel values from a raster using the function: rsgislib.vectorutils.polygoniseRaster2VecLyr()

But entering the required parameters does not start by returning the following message:

outvec="C:\Users\output.shp"
outlyr="test"
vecdrv="ESRI Shapefile"
inputImg='C:\\Users\rsgislib_seg\input.tif' #(raster with 5 bands)

I threw:

rsgislib.vectorutils.polygoniseRaster2VecLyr(outlyr,outvec,vecdrv,inputImg,imgBandNo=5,pxl_val_fieldname = 'VAL')

Showing the following error:

Warning 6: dataset C:\Users\input.shp does not support layer creation option OVERWRITE
Polygonising...
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\Anaconda3\envs\rsgislib\lib\site-packages\rsgislib\vectorutils_init_.py",
line 373, in polygoniseRaster2VecLyr
gdal.Polygonize(imgBand, imgMaskBand, outLayer, dstFieldIdx, [], callback=gdal.TermProgress)
File "C:\Users\Anaconda3\envs\rsgislib\lib\site-packages\osgeo\gdal.py", line 3130, in Polygonize
return _gdal.Polygonize(*args, **kwargs)
RuntimeError: Object given is not a Python function

How can I do?
Thank's, Vincenzo

Peter Bunting

unread,
Nov 11, 2019, 9:30:59 AM11/11/19
to Vincenzo Fiozzo, RSGISLib
Hi Vincenzo, 

I’m afraid that GitHub repo is nothing to do with us so I don’t think you’ll get a reply from that. 

In terms of this issue, I think it is related to the gdal.TermProgress function which isn’t available on windows. 

I’m afraid we don’t have time, or access to windows computers, to really support windows. I’d recommend using linux. On windows 10 this can be done by installing the linux subsystem or by using docker. You can download a docker image I have already set up from here: https://hub.docker.com/r/petebunting/au-eoed

The following doc has some info on running RSGISLib et al., using docker: https://www.remotesensing.info/tutorialmaterials/au-eoed_tools_docker.pdf

Best wishes, 

Pete

--
You received this message because you are subscribed to the Google Groups "RSGISLib Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rsgislib-suppo...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rsgislib-support/3729e5be-d290-4336-8ed5-7bf824136a25%40googlegroups.com.

Message has been deleted

Vincenzo Fiozzo

unread,
Nov 20, 2019, 10:47:53 AM11/20/19
to rsgislib...@googlegroups.com
Hi Peter,

I followed your advice and I'm using rsgislib on Linux but the problem remains identical even using the function:

from rsgislib import zonalstats

inputImage = '/home/ubuntu/input.tif' inputVector = '/home/ubuntu/input_vector.shp' outputVector = '/home/ubuntu/zonal_stats.shp' zonalattributes = zonalstats.ZonalAttributes(calcMean=True, calcStdDev=True) zonalstats.pixelStats2SHP(inputImage, inputVector, outputVector, zonalattributes, False, True, True, zonalstats.METHOD_POLYCONTAINSPIXELCENTER)

Receiving:

Segmentation error (core dump created)


How can I do that?
Pete

To unsubscribe from this group and stop receiving emails from it, send an email to rsgislib...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages