Is it possible to convert a PostGIS raster back to a line?
I'd like to generalize some vector data by converting it to raster and altering the cellsize to fix 'gaps' in the vector connectivity.
Once I've reached a good raster cellsize, I'd like to convert that raster back to a vector line, connecting all the cell centroids into continuous lines within a given tolerance (so as not to connect too many adjacent cells at intersections).
I figure the query would look something like this, but can't figure out what the outer function would be:
Convert To Vector (line) (
Convert to Raster(cellsize)
(
Original Line (geom)
)
)
One simple example would be to convert the raster 'line' back to a vector as in the ST_AsRaster documentation SQL:
ST_AsRaster(
ST_Buffer(
ST_GeomFromText('LINESTRING(50 50,150 150,150 50)'), 10,'join=bevel'),
200,200,ARRAY['8BUI', '8BUI', '8BUI'], ARRAY[118,154,118], ARRAY[0,0,0]);