Using no data values during tiling

54 views
Skip to first unread message

Alex M. Hamer

unread,
Aug 11, 2017, 8:35:19 AM8/11/17
to RSGISLib Support
Hi,

I am currently attempting to tile an image I have masked and populated image stats for using imageutils.maskImage and imageutils.popImageStats. However, the no data value I set in popImageStats is being ignored when I use imageutils.createTiles it tiles the no data values as if they were data values.

Is there a way to set a no data value within createTiles so no data values are displayed as no data values during tiling?

Regards,
Alex

Pete Bunting [pfb]

unread,
Aug 14, 2017, 6:16:20 AM8/14/17
to Alex M. Hamer, RSGISLib Support
Dear Alex, 

I don’t get want you are trying to do here… 

Create tiles will only split the image using the whole image dimensions - is doesn’t do anything with the pixel values other than copy them into the new tile images. 

If you want to create tiles which gave a minimum proportion of valid data you can use the following functions to create a shapefile with polygons defining the tiles and then use the second function to cut out the tiles. 

rsgislib.imageutils.tilingutils.createMinDataTiles(inputImage, outshp, outclumpsFile, width, height, validDataThreshold, maskIntersect=None, offset=False, force=True, tmpdir=’tilestemp’)

rsgislib.imageutils.tilingutils.createTileMaskImagesFromShp(inputImage, tileShp, tilesNameBase, tilesMaskDIR, tmpdir=’tilestemp’, imgFormat=’KEA’)

Best wishes, 

Pete

****************************************************
* Dr Pete Bunting
* Reader in Remote Sensing
* Earth Observation and Ecosystem Dynamics Group
* Department of Geography and Earth Sciences
* Aberystwyth University
* Aberystwyth
* Ceredigion
* SY23 3DB
* UK

* Ph: +44 (0) 1970 622615
* Mob: +44 (0) 7917 842743
* Email: p...@aber.ac.uk
* ORCID: http://orcid.org/0000-0002-7435-0148
****************************************************
"Please consider the environment before printing this email or any documents attached”

--
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 post to this group, send email to rsgislib...@googlegroups.com.
Visit this group at https://groups.google.com/group/rsgislib-support.
For more options, visit https://groups.google.com/d/optout.



--------------------------------------------------------------------
Un o’r 5 prifysgol uchaf yn y DU a’r orau yng Nghymru am fodlonrwydd myfyrwyr.
(Arolwg Cenedlaethol y Myfyrwyr 2017)
www.aber.ac.uk

Top 5 UK university and best in Wales for student satisfaction
(National Student Survey 2017)
www.aber.ac.uk
Message has been deleted

Pete Bunting [pfb]

unread,
Aug 30, 2017, 3:48:59 AM8/30/17
to Alex M. Hamer, RSGISLib Support
Hi Alex, 

It do you know which shapefile it is failing on? Does it have any valid data? Does it fail if you just run that one separately? 

Best wishes, 

Pete
****************************************************
* Dr Pete Bunting
* Reader in Remote Sensing
* Earth Observation and Ecosystem Dynamics Group
* Department of Geography and Earth Sciences
* Aberystwyth University
* Aberystwyth
* Ceredigion
* SY23 3DB
* UK

* Ph: +44 (0) 1970 622615
* Mob: +44 (0) 7917 842743
* Email: p...@aber.ac.uk
* ORCID: http://orcid.org/0000-0002-7435-0148
****************************************************
"Please consider the environment before printing this email or any documents attached”

On 21 Aug 2017, at 17:12, Alex M. Hamer <alexm...@outlook.com> wrote:

Hi Pete,

I have created the shapefile defining the tiles for my image, however when I use the createTileMaskImagesFromShp() it creates all of the tiles as shp files in the temporary directory and begins to rasterise each one until I get the following error after ~500 tiles:

 File "min_tile.py", line 11, in <module>
    imageutils.tilingutils.createTileMaskImagesFromShp(VVsubImg, shp, tilesImgBase, tilesMaskDIR, tmpdir, imgFormat='KEA')
  File "/home/student/miniconda3/envs/exampkgs/lib/python3.5/site-packages/rsgislib/imageutils/tilingutils.py", line 207, in createTileMaskImagesFromShp
    vectorutils.rasterise2Image(shpFile, inputImage, imgTileFile, imgFormat, shpAtt=None, shpExt=True)
  File "/home/student/miniconda3/envs/exampkgs/lib/python3.5/site-packages/rsgislib/vectorutils/__init__.py", line 96, in rasterise2Image
    raise e
  File "/home/student/miniconda3/envs/exampkgs/lib/python3.5/site-packages/rsgislib/vectorutils/__init__.py", line 73, in rasterise2Image
    inVectorLayer = inVectorDS.GetLayer(0)
AttributeError: 'NoneType' object has no attribute 'GetLayer'

Regards,
Alex
To post to this group, send email to rsgisli...@googlegroups.com.



--------------------------------------------------------------------
Un o’r 5 prifysgol uchaf yn y DU a’r orau yng Nghymru am fodlonrwydd myfyrwyr.
(Arolwg Cenedlaethol y Myfyrwyr 2017)
www.aber.ac.uk

Top 5 UK university and best in Wales for student satisfaction
(National Student Survey 2017)
www.aber.ac.uk

--
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 post to this group, send email to rsgislib...@googlegroups.com.
Visit this group at https://groups.google.com/group/rsgislib-support.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages