[postgis-users] irregular tiling with raster2pgsql - imported raster has nodata value on the edge

129 views
Skip to first unread message

Jakub Hettler

unread,
Aug 26, 2012, 1:22:28 PM8/26/12
to postgi...@postgis.refractions.net
Hi all,
I would like to ask if there is a way how to import tiled raster into PostGIS through raster2pgsql, but I need to make tiled raster, say 256x256, but at the end of raster I have last tiles (on the east and south side) which is on half out of the original raster (raster ends fe in the middle of last tile). If I try to load imported raster into QGIS or use gdal_translate I have nodata value on this place in the raster. Is there a way how to import the raster with the smaller last tiles on the east and south edges?

Thanks

Jakub

Andrew Babiy

unread,
Aug 26, 2012, 2:41:47 PM8/26/12
to postgi...@postgis.refractions.net
В Sun, 26 Aug 2012 19:22:28 +0200
Jakub Hettler <jakub....@gmail.com> пишет:

Irregular tiling possible with postgis and raster, bud GDAL postgis
raster module do not support irregular tiling now.
_______________________________________________
postgis-users mailing list
postgi...@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

Bborie Park

unread,
Aug 26, 2012, 3:28:24 PM8/26/12
to PostGIS Users Discussion
Currently, that behavior is as expected due to the application of the
specified tile size from the upper-left corner. To minimize the tiles
with large swaths of NODATA, you should try to use a tile size that is
cleanly divisible (no remainder) by the raster's width and height or a
size with a large remainder. I usually recommend tile sizes of
100x100 or smaller though sizes around 50x50 are even faster. In
terms of performance, the smaller the time size, the better the
performance.

-bborie
> _______________________________________________
> postgis-users mailing list
> postgi...@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>



--
Bborie Park
Programmer
Center for Vectorborne Diseases
UC Davis
530-752-8380
bkp...@ucdavis.edu

Jakub Hettler

unread,
Aug 27, 2012, 10:51:16 AM8/27/12
to PostGIS Users Discussion
Hi Bborie, 
I think, that not all rasters are divisible without remainder (except 1x1 tile) :)

My problem is this (this is my raster after raster2psql displayed with tiles)


I need to cut the last tiles on the east and south a make it smaller by the red line

But I think it is impossible now, but i will find the solution :)

I think about the function which will find the line of nodata value and then I make the polygon and intersect it with this polygon. :D

But if I understand it, if I cut last tiles and these will be smaller than others, I wont be able to load this raster into QGIS (PostGIS raster driver)

Thanks

Jakub



2012/8/26 Bborie Park <bkp...@ucdavis.edu>

Pierre Racine

unread,
Aug 27, 2012, 11:35:49 AM8/27/12
to PostGIS Users Discussion
This is ticket #826

http://trac.osgeo.org/postgis/ticket/826

Pierre

Bborie Park

unread,
Aug 27, 2012, 12:51:25 PM8/27/12
to postgi...@postgis.refractions.net
You could post-process those tiles on the east and south by running them
through ST_Clip. Since the pixels that are NODATA are consistently
located, the geometry to clip upon shouldn't be hard to make.

And correct to your last sentence. If you're using released versions of
GDAL and clip the east and south tile, GDAL will fail as this violates
the rules of regular blocking.

-bborie
Reply all
Reply to author
Forward
0 new messages