[postgis-devel] Setting raster constraint: spatial extent
David Haynes II
dahaynes at umn.edu
Wed Jul 23 12:45:46 PDT 2014
Hello,
I have posted this question on the PostGIS user group unsuccessfully and I
am hoping this question can be answered by this forum. The research project
I am working uses rasters with a world geographic extent. Often we find
that when downloading the data the merged raster tiles extend beyond the
defined geographic boundaries. For example, one landcover dataset
(Globcover) has a geographic extent of
-180.0013888888888971,-64.9986111111111171 :
179.9986111111111029,90.0013888888888829. It goes beyond the coordinate
system bounds by approximately half a cell in the north west quadrant. This
causes it fail when using raster2pgsql for ingest. Specifically applying
the raster extent constraint on the built table causes it to fail.
After much trial and error we can successfully ingest rasters by using
gdalwarp to crop the raster to the bouding coordinates (-180 90, 180 -90).
However the initial issue has returned to us because we are trying to use
MODIS data in its native projection (Sinusoidal). Even when cropped to the
appropriate bounding area the raster still fails on ingest. A solution was
to adjust the raster2pgsql script to use the "-x" parameter which drops the
spatial extent on ingest.
Now datasets are loading into our system. However we tried to go back and
set the geographic extent after of the raster were successfully generated,
and in doing that we have run into the same problem. We are unable set the
spatial extent of the MODIS data.
SELECT AddRasterConstraints('gis_rasters'::name, 'modis_IGBP_mask'::name,
'rast'::name, 'extent');
NOTICE: Adding maximum extent constraint
NOTICE: Unable to get the extent of the raster column. Attempting memory
efficient (slower) approach
CONTEXT: PL/pgSQL function addrasterconstraints(name,name,name,text[])
line 104 at assignment
NOTICE: Still unable to get the extent of the raster column. Cannot add
extent constraint
CONTEXT: PL/pgSQL function addrasterconstraints(name,name,name,text[])
line 104 at assignment
WARNING: Unable to add constraint: 'extent'. Skipping
ERROR: None of the constraints specified could be added. Is the schema
name, table name or column name incorrect?
The subfunction also returns false
SELECT _add_raster_constraint_extent('gis_rasters'::name,
'modis_IGBP_mask'::name, 'rast'::name) FROm gis_rasters.modis_IGBP_mask
Yet, this function works and returns the bounding coordinates when using
ST_AsText()
SELECT ST_ConvexHull(ST_Collect(ST_ConvexHull(rast))) FROM
gis_rasters.modis_IGBP_mask
I have read through this ticket, but this seemed to be solved with a new
update. http://trac.osgeo.org/postgis/ticket/2050
Any help would be appreciated.
--
David Haynes, Ph.D.
Research Associate Terra Populous
Minnesota Population Center
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20140723/f755892c/attachment.html>
More information about the postgis-devel
mailing list