[postgis-users] ST_Buffer + grid problem

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Fri Mar 23 08:11:17 PDT 2012


> Is this ok? Once I have made the raster, I can then transform it back to srid 4326
> before doing PixelAsPolygons right?

You definitely have to be able to view your grid and your data. So you can quickly make sure both extents are ok.

This seems to be very big comparing with what I got the other day (1020x24798). You will end up with way too many polygons (361932 x 423152 = 153152249664)... Even if you cut by two to remove the ones that fall in the water. You will have to do everything in raster space (the ST_MapAlgebraFct technique) and that would be too slow. 

I think the best approach in this case would go like this:

1) Tile your grid (smaller the better)

2) Write a function burning a rasterization of each road in the right tile using ST_MapAlgebra(rast, ST_AsRaster(roadgeom)) taking the actual value of the tile into account

That might work fast enough.

Pierre



More information about the postgis-users mailing list