[postgis-users] PostGIS Raster for Met Data

Michael Akinde michael.akinde at met.no
Mon Jul 11 01:56:31 PDT 2011


Hi,

Thanks for the responses.

----- Original Message -----
> For sure doing overlay gis operations like st_intersection is not
> possible when the srid of the two geometries is different. In this
> case you would have to reproject (ST_Transform) the geometry so it fit
> the srid of right grid. But if your application is able to decide
> which grid it must query then it should also be able to decide which
> tale it must query and hence putting all your grids in different table
> should not be a problem.

For the general case (particularly in the coast example, where the queries are basically just Lon/Lat), we would not know which grid contains the answer. Consequently we would have to do two queries (one to determine the grid to query and one to query the specific grid), where today we make do with one. I suspect that this would cost us a fair bit of performance.
 
> > No, the former is handled quite nicely by ST_INTERSECT, if I've 
> > understood 
> > correctly. I was thinking of a function that returns the x, y
> > offsets; i.e., 0 0 for
> > the origin point, 1 0 for the next point along the x axis, and so
> > on. Since we have
> > our value data stored in files outside the database, the x,y offsets
> > allow us to
> > retrieve data points very rapidly. This is how we have it
> > implemented in WDB
> > today, but with our own very limited function for identifying those
> > offsets.
> 
> You can easily get the x,y upperleft corner of a pixel with the
> Raster2WorldcoordX(0,0) and Raster2WorldcoordY(1,0) functions. Is that
> what you need?

Not quite - I was thinking more of World2RasterCoord, but using a geometry to extract multiple raster points. Essentially, ST_INTERSECT, but returning raster coordinates rather than world coordinates and value.
 
> But normally, if you store your rasters in the database, you don't
> have to do that anymore to get the raster value associated with a
> point. You can just do:
> 
> SELECT ST_Value(rast, ST_MakePoint(x,y))
> FROM yourgridtable
> WHERE ST_Intersects(rast, ST_MakePoint(x,y))

I understand that. I'm dubious as to whether we can store out rasters in the database though, given the limitations to single SRID. Thus my trying to figure out alternatives approaches for us to work with the raster support in PostGIS.

Regards,

Michael A.



More information about the postgis-users mailing list