ST CLip oddity

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

ST CLip oddity

Kit Smith
Hi All


Background: I've a number of largish raster files that I need to manage
change on, which I'm doing by tiling them to small tiles and updating
and tracking the the tiles that change. To that end I create a set of
10x10 tiles with consistent ULX and ULY over my sets. I expect each tile
to 10x10 (either at 5m or 30m resolution)


I'm clipping the tiles from an iterated geom starting from the upper
left, but I've hit an odd output demonstrated below.

In this particular example a appear to be getting one more row of pixels
at the right and lower edges than the geom extent.

If I re-clip the union, I do get the expected result.

Is that the safe way to play? Or am I missing something else here?


SELECT 30,
st_upperleftx(rast),
st_upperlefty(rast),
rast
FROM
   (SELECT  ST_UNION(ST_Clip(rast,
st_makeenvelope(0,400000,50,400050,29902)))   rast
   FROM juno.ie_flrf_u_rp75_rd_5m_29902
   WHERE ST_Intersects(rast,st_makeenvelope(0,400000,50,400050,29902))
   ) r



  ?column? | st_upperleftx | st_upperlefty |
st_astext
----------+---------------+---------------+-----------------------------------------------------------
        30 |             0 |        400050 | POLYGON((0 400050,55
400050,55 399995,0 399995,0 400050))
(1 row)

The query
SELECT 30,
   st_upperleftx(rast),
   st_upperlefty(rast),
   st_astext(st_envelope(rast))

FROM
     (SELECT  ST_UNION(ST_Clip(rast,
st_makeenvelope(0,400000,50,400050,29902)))   rast
     FROM juno.ie_flrf_u_rp75_rd_5m_29902
     WHERE ST_Intersects(rast,st_makeenvelope(0,400000,50,400050,29902))
) r


juno-> \g
-[ RECORD 1 ]----+---------------------------------------------------
r_table_catalog  | juno
r_table_schema   | juno
r_table_name     | ie_flrf_u_rp75_rd_5m_29902
r_raster_column  | rast
srid             | 29902
scale_x          | 5
scale_y          | -5
blocksize_x      | 100
blocksize_y      | 100
same_alignment   | t
regular_blocking | f
num_bands        | 1
pixel_types      | {32BF}
nodata_values    | {-3.40282346638529e+38}
out_db           | {f}
extentastext     | POLYGON((0 0,0 600000,400000 600000,400000 0,0 0))
spatial_index    | t



SELECT 30,
st_upperleftx(rast),
st_upperlefty(rast),
st_astext(st_envelope(rast)) extentrast,
st_astext(st_envelope(st_clip(rast,st_makeenvelope(0,400000,50,400050,29902))))
reclip
FROM
(SELECT  ST_UNION(ST_Clip(rast,
st_makeenvelope(0,400000,50,400050,29902)))   rast
FROM juno.ie_flrf_u_rp75_rd_5m_29902
WHERE ST_Intersects(rast,st_makeenvelope(0,400000,50,400050,29902))
) r

-[ RECORD 1 ]-+----------------------------------------------------------
?column?      | 30
st_upperleftx | 0
st_upperlefty | 400050
extentrast    | POLYGON((0 400050,55 400050,55 399995,0 399995,0 400050))
reclip        | POLYGON((0 400050,50 400050,50 400000,0 400000,0 400050))
Find out more about us here: www.jbarisk.com<http://www.jbarisk.com/> and follow us on Twitter @JBARisk<http://twitter.com/JBARisk> and LinkedIn<https://www.linkedin.com/company/2370847?trk=tyah&trkInfo=clickedVertical%3Acompany%2CclickedEntityId%3A2370847%2Cidx%3A2-1-2%2CtarId%3A1447414259786%2Ctas%3AJBA%20RISK%20MANAGEMENT>

The JBA Group supports the JBA Trust.

All JBA Risk Management's email messages contain confidential information and are intended only for the individual(s) named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail.
Please notify the sender immediately by email if you have received this email by mistake and delete this email from your system.


JBA Risk Management Limited is registered in England, company number 07732946, South Barn, Broughton Hall, Skipton, North Yorkshire, BD23 3AE, Telephone: +441756799919


_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users