|
From: Christian M. <chr...@os...> - 2013-06-08 13:28:18
|
Hi Mike The plugin uses "as_tiff" when fetching raster data. If you do some test queries, include st_astiff. Example: select st_numbands(st_astiff(rast)) from test instead of select st_numbands(rast) from test Christian 2013/6/6 mrollans <mro...@gm...> > I'm trying to serve a single band raster from postgis though GeoServer > using > the Image Mosaic JDBC plugin. In short I'm seeing an issue such that the > values in my single band are truncated to byte values between 0 and 255. > Additionally, what was a single band raster appears as 3 band when viewed > through GeoServer. My intention is to serve the raster such that I can > colorize it using an SLD in GeoServer for display through WMS and get data > points from the band through WCS. Further details follow. > > I have setup my mosaic table in postgis as described here > > http://docs.geotools.org/latest/userguide/library/coverage/pgraster.html > > > I insert the single band geotiff with Float32 data type as a single row in > to the table test using > > raster2pgsql -s 4326 -I -C -M test.tif public.test | psql -d postgis -h > localhost -U postgres > > > and insert a value in the mosaic table with > > insert into mosaic (name, tiletable) values ('test', 'test') > > > I can verify that the geotiff appears to be loaded into postgis properly by > running. > > select st_numbands(rast) from test > > to return the number of bands, this returns 1 as expected. > > > and running > > select st_value(rast, 1, 50, 50) from test > > to return the value at a specific point. This case returns > -7305.72021484375 which is an expected value > > > I have also verified that it appears to be a single band raster with data > by > pulling the raster out of postgis using Quantum GIS and viewing the details > associated with it. I can apply color styles to the raster in Quantum GIS > and that works as expected. > > > I can also verify that GeoServer will serve the GeoTiff properly when > configured as a GeoTiff raster data store directly off the filesystem (not > going through postgis). It appears as a single band raster which I can > colorize with an SLD, everything works as expected. > > > When I try to load the raster into GeoServer from postgis as an > ImageMosaicJDBC raster data source, things go awry. > > My config files are as such. > > 1. connect.pgraster.xml.inc > > <connect> > > <dstype value="DBCP"/> > > <username value="postgres" /> > <password value="password1" /> > <jdbcUrl value="jdbc:postgresql://localhost:5432/postgis" /> > <driverClassName value="org.postgresql.Driver"/> > <maxActive value="10"/> > <maxIdle value="0"/> > </connect> > > 2. mapping.pgraster.xml.inc > > <spatialExtension name="pgraster"/> > <mapping> > <masterTable name="MOSAIC" > > <coverageNameAttribute name="NAME"/> > <maxXAttribute name="maxX"/> > <maxYAttribute name="maxY"/> > <minXAttribute name="minX"/> > <minYAttribute name="minY"/> > <resXAttribute name="resX"/> > <resYAttribute name="resY"/> > <tileTableNameAtribute name="TileTable" /> > </masterTable> > <tileTable> > <blobAttributeName name="rast" /> > </tileTable> > </mapping> > > 3. test.pgraster.xml.inc > > <?xml version="1.0" encoding="UTF-8" standalone="no"?> > <!DOCTYPE ImageMosaicJDBCConfig [ > <!ENTITY mapping PUBLIC "mapping" > "mapping.pgraster.xml.inc"> > <!ENTITY connect PUBLIC "connect" > "connect.pgraster.xml.inc"> > ]> > > <config version="1.0"> > <coverageName name="test"/> > <coordsys name="EPSG:4326"/> > > <scaleop interpolation="1"/> > &mapping; > &connect; > </config> > > I can create the datasource and publish the layer all without error. > However, when I try to view the layer in GeoServer with the OpenLayers > layer > preview I see a completely black and white image, not greyscale as > expected. > Also, clicking a point in the image shows there are now 3 bands (test, > test_Band1, test_Band2) with values that appear to be either (0.0, 0.0, > 0.0) > or (255.0, 255.0, 255.0). All of my data values appear to be lost. > > If I issue a DescribeCoverage request against the WCS the range section > appears as such > > <wcs:Range> > <wcs:Field> > <wcs:Identifier>contents</wcs:Identifier> > <wcs:Definition> > <ows:AllowedValues> > <ows:Range> > <ows:MinimumValue>0.0</ows:MinimumValue> > <ows:MaximumValue>255.0</ows:MaximumValue> > </ows:Range> > </ows:AllowedValues> > </wcs:Definition> > <wcs:InterpolationMethods> > <wcs:InterpolationMethod>linear</wcs:InterpolationMethod> > <wcs:InterpolationMethod>cubic</wcs:InterpolationMethod> > </wcs:InterpolationMethods> > <wcs:Axis identifier="Bands"> > <wcs:AvailableKeys> > <wcs:Key>test</wcs:Key> > <wcs:Key>test</wcs:Key> > <wcs:Key>test</wcs:Key> > </wcs:AvailableKeys> > </wcs:Axis> > </wcs:Field> > </wcs:Range> > > Does anyone know a reason why this would happen? Does the Image Mosaic > JDBC > plugin only support 3 band images of Byte type? I'm running GeoServer > 2.3.2, postgresql 9.2.4 and postgis 2.0.3. Let me know if I can provide > any > additional details that might be helpful. > > Thanks, > > Mike > > > > > > > -- > View this message in context: > http://osgeo-org.1560.x6.nabble.com/Image-Mosaic-JDBC-single-band-raster-losing-data-values-tp5058549.html > Sent from the GeoServer - User mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > How ServiceNow helps IT people transform IT departments: > 1. A cloud service to automate IT design, transition and operations > 2. Dashboards that offer high-level views of enterprise services > 3. A single system of record for all IT processes > http://p.sf.net/sfu/servicenow-d2d-j > _______________________________________________ > Geoserver-users mailing list > Geo...@li... > https://lists.sourceforge.net/lists/listinfo/geoserver-users > -- DI Christian Mueller MSc (GIS), MSc (IT-Security) OSS Open Source Solutions GmbH |