Em 18/07/2019 10:12, Pierre Racine escreveu:

What is your goal : to simplify the queries expression or to optimize the processing time?


The goal is a bit theoretic, focused on gainning expressiveness for query languages, by joinning both query and a map algebra language together. so that regions in the raster side could be identified by algebraic expressions. Some topological assumptions must be considered so the nine-interceptions method can be applied with no format conversion. I guess PostGIS can be a platform to go around the issue.

Yes it would work with touch as well.

At some point you have to convert pixels to something that is comparable with vector. The point is to lower this conversion to the minimum. The trick in PostGIS it to tile everything so that only required tiles are converted. You could certainly have some better algorithms than what ST_Intersects(d.geom, e.rast) is doing to process at the pixel level instead of at the tile level.

Pierre

*De :*Joao Cordeiro <[email protected]>
*Envoyé :* 17 juillet 2019 10:30
*À :* Pierre Racine <[email protected]>
*Objet :* Re: [postgis-users] raster regions

Hi, Pierre,

Thanks, I appreciate your replies .

That is quite a clear and readable solution to describing an i*ntercepting* situation. Should it work with *st_touch *as well? Without any raster-vector conversion for the data? My "consume dream" is to have it all in a single query expression, in which the SQL parser delegates to a map algebra parser the evaluation of a kind of "pertinence criteria" to regions described through "map algebraic" expressions. I guess, usinga binary representation to "identify" the regions will allways break an user question into two! For instance, a question such as "an specific natural event (such as flooding) touching a given municipality", would allways demmand for some (tricky) adequate binary data, prior to being expressed in the query language.

Regards

Em 16/07/2019 10:05, Pierre Racine escreveu:

    Right. To minimize the amount of intermediate computation you can
    add a discriminant to the first query:

    WITH floodareas AS (

      SELECT ST_MapAlgebra(rast, ‘1BB’, ‘CASE WHEN [rast] < 10 THEN 1
    ELSE NULL END’) rast

      FROM elevation e, districts d

      WHERE ST_Intersects(d.geom, e.rast)

    )

    SELECT d.*

    FROM districts d, floodareas f

    WHERE ST_Intersects(d.geom, f.rast)

    Pierre

    *De :*postgis-users <[email protected]>
    <mailto:[email protected]> *De la part de*
    [email protected] <mailto:[email protected]>
    *Envoyé :* 15 juillet 2019 14:40
    *À :* [email protected]
    <mailto:[email protected]>
    *Objet :* Re: [postgis-users] raster regions

    Thanks, Pierre,

    It seems ok to model the query the way you showed, however, that
    implies the generation of an entire intermediate binary raster,
    just to identify the region inside the whole mapped area. My issue
    is on avoiding such intermediate data by incorporating map algebra
    expression into the same query expression, Another example, ""...
    d.geom touch (ndvi2018 < ndvi2019)" where ndvixxxx are raster data.

    Att.

    Em 15-07-2019 14:43, Pierre Racine escreveu:

        Hi,

        That could translate into something like this in PostGIS:

        WITH floodareas AS (

        SELECT ST_MapAlgebra(rast, ‘1BB’, ‘CASE WHEN [rast] < 10 THEN
        1 ELSE NULL END’) rast

        FROM elevation

        )

        SELECT d.*

        FROM districts d, floodareas f

        WHERE ST_Intersects(g.geom, f.rast)

        NULL becomes nodata values. You could also use ST_Reclass()
        instead of ST_Mapalgebra().

        Pierre

        *De :*postgis-users <[email protected]
        <mailto:[email protected]>> *De la part
        de* Joao Cordeiro
        *Envoyé :* 15 juillet 2019 10:19
        *À :* 'PostGIS Users Discussion'
        <[email protected]
        <mailto:[email protected]>>
        *Objet :* [postgis-users] raster regions

        Hi there,

        I am not actually a POSTGIS user, or developer, although I am
        doing some research of integration of vector -raster in a dbms
        context. My main question s about identifying regions
        represented in a domain like the "hybrid raster" so that they
        can be referred to in a query. For example, I would like to
        write something like "/*select d from districts where
        d.geometry touches flooding*/", where "flooding" indicates an
        expression intended to decide on the pertinence of locations
        to a flooding ​​risk area described, for instance through map
        algebra.

        Thanks for any hints or suggestions.

        Att.

        _______________________________________________

        postgis-users mailing list

        [email protected]  <mailto:[email protected]>

        https://lists.osgeo.org/mailman/listinfo/postgis-users



    _______________________________________________

    postgis-users mailing list

    [email protected]  <mailto:[email protected]>

    https://lists.osgeo.org/mailman/listinfo/postgis-users

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

Reply via email to