[postgis-users] Getting data from table with interval

Martin Davis mtnclimb at gmail.com
Fri Jan 7 10:28:18 PST 2022


How about this for an approach?

- Create a line from the start and end point using ST_MakeLine
- Densify it using ST_Segmentize (e.g. to a1 km interval)
- Extract the individual points using ST_DumpPoints
- For each point, query to find the nearest elevation point


On Thu, Jan 6, 2022 at 12:51 PM Luca Bertoncello <lucabert at lucabert.de>
wrote:

> Hi list!
>
> I have a table in my PostGIS database, with the ground elevation of Europe.
> The table is so:
>
> gis=# \d elevation
>                         Tabelle »public.elevation«
>   Spalte   |       Typ        | Sortierfolge | NULL erlaubt? | Vorgabewert
> -----------+------------------+--------------+---------------+-------------
>  latlng    | geography        |              |               |
>  lat       | double precision |              |               |
>  lng       | double precision |              |               |
>  elevation | real             |              |               |
>
> lat and lng are just used for an export to a SQLite-DB for use in an
> App. The same data are in "latlng" as geography...
> The table has currently a precision of 3x3 Km, but I can import data
> with a better precision, too, of course.
>
> So my question...
> I'd like to use these data to create a vertical profile similar to the
> one I can get from Google-Maps.
> Currently, with a simple query, I can get the elevation of a given point.
> Of course, I don't have _all_ point in the table, so I have to search
> the nearest point, but this is OK...
>
> What I need is a function that receive two coordinates as parameters.
> These coordinates define a line from A to B.
> I'd like to retrieve all elevations in this line, with a given interval,
> so that I can retrieve for example the elevation every kilometer or so.
>
> And I don't have any idea how to do that...
>
> Can someone suggest me a way?
>
> Thanks a lot
> Luca Bertoncello
> (lucabert at lucabert.de)
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20220107/51a3cd0c/attachment.html>


More information about the postgis-users mailing list