[postgis-devel] ST_Colormap

Regina Obe lr at pcorp.us
Mon Apr 25 22:48:46 PDT 2016


David,

I could be mistaken, but I always thought that for jpegs the spatial info is stored in a .jpegw file and since ST_ASJPEG only outputs the jpg part it wouldn't keep the spatial ref info.

 

Are you saying you loose it at the ST_ColorMap part or the ST_AsJPEG.  I would expect it maintained in ST_ColorMap and lost at ST_AsJPEG call.

 

Thanks,

Regina

 

From: postgis-devel [mailto:postgis-devel-bounces at lists.osgeo.org] On Behalf Of David Haynes II
Sent: Friday, April 22, 2016 12:51 PM
To: PostGIS Development Discussion <postgis-devel at lists.osgeo.org>
Subject: [postgis-devel] ST_Colormap

 

Hello

 

Working on an application for clipping rasters (data.terrapop.org/terraclip <http://data.terrapop.org/terraclip> ) and running into an issue with the ST_Colormap function. It seems that whenever we run the ST_Colormap function we lose the spatial reference information for the image.This is the sample of the query that we are running. The query is successful, but the resulting images can be built into a vrt with gdal. I'm using PostgreSQL 9.3.7  and POSTGIS 2.1.7.

 

WITH projection as

(

SELECT ST_SRID(rast) as srid

FROM gis_rasters.apricothar

Limit 1

),polygon as

(

SELECT sgl.id <http://sgl.id>  as sample_geog_level_id, gi.id <http://gi.id>  as geog_instance_id, gi.label as geog_instance_label,

gi.code as geog_instance_code, ST_Transform(bound.geog::geometry, prj.srid) as geom

FROM projection prj, sample_geog_levels sgl

inner join geog_instances gi on sgl.id <http://sgl.id>  = gi.sample_geog_level_id

inner join boundaries bound on bound.geog_instance_id = gi.id <http://gi.id> 

WHERE sgl.id <http://sgl.id>  = 226

),raster_clip as

(

SELECT ST_Clip(r.rast, 1, p.geom, TRUE) AS rast 

FROM polygon p inner join gis_rasters.apricothar  r on ST_Intersects(r.rast,p.geom)

)

select ST_AsJPEG(ST_Colormap(rast, 1, 'greyscale'))  as img

from raster_clip, projection prj

 

-- 

David Haynes, Ph.D.

Research Associate Terra Populus

Minnesota Population Center

612-626-3933

www.terrapop.org <http://www.terrapop.org> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20160426/4f85826b/attachment.html>


More information about the postgis-devel mailing list