Hi

In my project https://sourceforge.net/p/treintaytres/code/HEAD/tree/trunk/code_files/data_storage/ I have the table

TABLE_SCHEMA    TABLE_NAME      DATA_TYPE       TYPE_NAME       COLUMN_NAME
treintaytres    topo_files␟t    1111            uuid            id
treintaytres    topo_files␟t    93              timestamptz     entry_pit
treintaytres    topo_files␟t    1111            uuid            source_id
treintaytres    topo_files␟t    12              text            file_name
treintaytres    topo_files␟t    1111            raster          tile
treintaytres    topo_files␟t    93              timestamptz     
file_creation_pit
treintaytres    topo_files␟t    12              text            file_hash

TILE contains topographical height raster data from OpenTopography. They are from different regions, let's say, some tiles cover Switzerland, some cover New Zealand. I want to create slope and other data from the height data and I have some questions I hope you can answer or point me to answers.

a) Is it more efficient to convert the raster to vector data and calculate on the those than to calculate directly on the raster?

b) To my understanding, if I calculate the slope on a raster tile, the slope,… of the borders will have accuracy problems. My I idea, was to "stitch" a tile with its direct neighbours, calculate on the composed tile, and either save a cropped calculated composed tile to its original dimension or save the calculated composed tile as is, probably the latter.
Can I compose as follows?
with RASTER_NEIGHBORS as (         select R1.TILE   as CURRENT_TILE
                                         ,R2.TILE   as NEIGHBOR_TILE
                                         ,R1.ID     as CURRENT_ID
                                     from TOPO_FILES␟T R1
                          left outer join TOPO_FILES␟T R2
                                       on ST_Touches(R1.TILE
                                                    ,R2.TILE)
                                       or ST_Intersects(R1.TILE
                                                       ,R2.TILE)
                                    where TRUE
--and R1.ID = '6b8ca53a-bb5f-4c2b-a9c9-94b6a706e9b0'
                                      and TRUE)
   ,NION as (select CURRENT_TILE as TILE
                   ,CURRENT_ID
               from RASTER_NEIGHBORS
             union
             select NEIGHBOR_TILE as TILE
                   ,CURRENT_ID
               from RASTER_NEIGHBORS)
  select ST_Union(TILE) as COMPOSED_TILE
        ,CURRENT_ID
    from NION
group by CURRENT_ID;

c) Finally, I want to select all the areas where slope, TRI,… conform certain criteria and have a minium surface size. Do I do it this better on vector data and do I need to do this on data composed of all the contiguous areas?

I would be grateful for any nudge into the right direction. Maybe URLs with samples.

Kind regards

Thiemo

Reply via email to