[GRASS-user] rasterize 3d line

Is there a way to rasterize a 3d line to get altitude on raster cells
crossed by the line ?

not quite sure what are you trying to do?

maybe:

v.drape:

Converts 2D vector features to 3D by sampling of elevation raster map. (https://grass.osgeo.org/grass82/manuals/v.drape.html)
Additional vertices can be added to the input 2D vector map with v.split.

or the something like:

v.fixed.segmentpoints - segment points along a vector line with fixed distances (https://grass.osgeo.org/grass82/manuals/addons/v.fixed.segmentpoints.html) followed by
v.what.rast - Uploads raster values at positions of vector points to the table (https://grass.osgeo.org/grass82/manuals/v.what.rast.html) or v.sample - Samples a raster map at vector point locations (https://grass.osgeo.org/grass82/manuals/v.sample.html).

kind regards
helmut

Hello,

Thank you for your message. But I don't think it helps me.

I want to add a bridge elevation to my DEM. So if I create a 3d vector line (my bridge) with two vertex at x,y,z coordinates, and is it possible to convert in a raster where each cells crossed by the line inherits of his extrapolated altitude ? If no module exists to do that, what would be the operations necessary to achieve this result ? I hope it is clearer.

Frank

Le 07/04/2023 à 10:16, Helmut Kudrnovsky a écrit :

Is there a way to rasterize a 3d line to get altitude on raster cells
crossed by the line ?

not quite sure what are you trying to do?

maybe:

v.drape:

Converts 2D vector features to 3D by sampling of elevation raster map. (https://grass.osgeo.org/grass82/manuals/v.drape.html)
Additional vertices can be added to the input 2D vector map with v.split.

or the something like:

v.fixed.segmentpoints - segment points along a vector line with fixed distances (https://grass.osgeo.org/grass82/manuals/addons/v.fixed.segmentpoints.html) followed by
v.what.rast - Uploads raster values at positions of vector points to the table (https://grass.osgeo.org/grass82/manuals/v.what.rast.html) or v.sample - Samples a raster map at vector point locations (https://grass.osgeo.org/grass82/manuals/v.sample.html).

kind regards
helmut

Hi Franck,

I would suggest you to do sth as follows :

- if necessary add vertice along your 3d lines (v.split ?) so their
"density" is roughly equivalent to (or better smaller than) your target
raster resolution ;
- turn your vector lines to points using v.to.points (with use=vertex
argument) ;
- convert this vector point map to a raster with v.to.rast (with use=z
argument) ;
- depending on what you do afterwards with that map, you can have a
look at r.null to manage null raster cells (e.g. setnull=0).

Hope this helps,

V.

Le vendredi 07 avril 2023 à 12:45 +0200, Frank David a écrit :

Hello,

Thank you for your message. But I don't think it helps me.

I want to add a bridge elevation to my DEM. So if I create a 3d
vector
line (my bridge) with two vertex at x,y,z coordinates, and is it
possible to convert in a raster where each cells crossed by the line
inherits of his extrapolated altitude ? If no module exists to do
that,
what would be the operations necessary to achieve this result ? I
hope
it is clearer.

Frank

Le 07/04/2023 à 10:16, Helmut Kudrnovsky a écrit :
> > Is there a way to rasterize a 3d line to get altitude on raster
> > cells
> > crossed by the line ?
> not quite sure what are you trying to do?
>
> maybe:
>
> v.drape:
>
> Converts 2D vector features to 3D by sampling of elevation raster
> map. (https://grass.osgeo.org/grass82/manuals/v.drape.html)
> Additional vertices can be added to the input 2D vector map with
> v.split.
>
> or the something like:
>
> v.fixed.segmentpoints - segment points along a vector line with
> fixed distances
> (https://grass.osgeo.org/grass82/manuals/addons/v.fixed.segmentpoints.html
> ) followed by
> v.what.rast - Uploads raster values at positions of vector points
> to the table
> (https://grass.osgeo.org/grass82/manuals/v.what.rast.html) or
> v.sample - Samples a raster map at vector point locations
> (https://grass.osgeo.org/grass82/manuals/v.sample.html).
>
>
> kind regards
> helmut
>
>
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Hi

Could you use the line to select the raster dem cells, then use the center of the selected cells to snap back to your line and use these snap coordinates to proportion the zvalue of the snapped line segment?

HTH

Zoltan

Sent from Blue
On 07 Apr 2023, at 14:47, Vincent Bain <bain@toraval.fr> wrote:

Hi Franck,

I would suggest you to do sth as follows :

- if necessary add vertice along your 3d lines (v.split ?) so their
"density" is roughly equivalent to (or better smaller than) your target
raster resolution ;
- turn your vector lines to points using [v.to](http://v.to).points (with use=vertex
argument) ;
- convert this vector point map to a raster with [v.to](http://v.to).rast (with use=z
argument) ;
- depending on what you do afterwards with that map, you can have a
look at r.null to manage null raster cells (e.g. setnull=0).

Hope this helps,

V.

Le vendredi 07 avril 2023 à 12:45 +0200, Frank David a écrit :

> Hello,
>  
>  Thank you for your message. But I don't think it helps me.
>  
>  I want to add a bridge elevation to my DEM. So if I create a 3d
>  vector 
>  line (my bridge) with two vertex at x,y,z coordinates, and is it 
>  possible to convert in a raster where each cells crossed by the line 
>  inherits of his extrapolated altitude ? If no module exists to do
>  that, 
>  what would be the operations necessary to achieve this result ? I
>  hope 
>  it is clearer.
>  
>  Frank
>  
>  Le 07/04/2023 à 10:16, Helmut Kudrnovsky a écrit :
> 
> > > Is there a way to rasterize a 3d line to get altitude on raster
> > >  cells
> > >  crossed by the line ?
> > 
> >  not quite sure what are you trying to do?
> >  
> >  maybe:
> >  
> >  v.drape:
> >  
> >  Converts 2D vector features to 3D by sampling of elevation raster
> >  map. ([https://grass.osgeo.org/grass82/manuals/v.drape.html](https://grass.osgeo.org/grass82/manuals/v.drape.html))
> >  Additional vertices can be added to the input 2D vector map with
> >  v.split.
> >  
> >  or the something like:
> >  
> >  v.fixed.segmentpoints - segment points along a vector line with
> >  fixed distances
> >  ([https://grass.osgeo.org/grass82/manuals/addons/v.fixed.segmentpoints.html](https://grass.osgeo.org/grass82/manuals/addons/v.fixed.segmentpoints.html)
> >  ) followed by
> >  v.what.rast - Uploads raster values at positions of vector points
> >  to the table
> >  ([https://grass.osgeo.org/grass82/manuals/v.what.rast.html](https://grass.osgeo.org/grass82/manuals/v.what.rast.html)) or
> >  v.sample - Samples a raster map at vector point locations
> >  ([https://grass.osgeo.org/grass82/manuals/v.sample.html](https://grass.osgeo.org/grass82/manuals/v.sample.html)).
> >  
> >  
> >  kind regards
> >  helmut
> 
> ---
> 
>  grass-user mailing list
>  grass-user@lists.osgeo.org
>  [https://lists.osgeo.org/mailman/listinfo/grass-user](https://lists.osgeo.org/mailman/listinfo/grass-user)

---

grass-user mailing list
grass-user@lists.osgeo.org
[https://lists.osgeo.org/mailman/listinfo/grass-user](https://lists.osgeo.org/mailman/listinfo/grass-user)

Hi Vincent,

Yes it’ works ! thank you for the trick

Regards,

Frank

···

Le 07/04/2023 à 13:37, Vincent Bain a écrit :

Hi Franck,

I would suggest you to do sth as follows :

- if necessary add vertice along your 3d lines (v.split ?) so their
"density" is roughly equivalent to (or better smaller than) your target
raster resolution ;
- turn your vector lines to points using v.to.points (with use=vertex
argument) ;
- convert this vector point map to a raster with v.to.rast (with use=z
argument) ;
- depending on what you do afterwards with that map, you can have a
look at r.null to manage null raster cells (e.g. setnull=0).

Hope this helps,

V.

Le vendredi 07 avril 2023 à 12:45 +0200, Frank David a écrit :

Hello,

Thank you for your message. But I don't think it helps me.

I want to add a bridge elevation to my DEM. So if I create a 3d
vector 
line (my bridge) with two vertex at x,y,z coordinates, and is it 
possible to convert in a raster where each cells crossed by the line 
inherits of his extrapolated altitude ? If no module exists to do
that, 
what would be the operations necessary to achieve this result ? I
hope 
it is clearer.

Frank

Le 07/04/2023 à 10:16, Helmut Kudrnovsky a écrit :

Is there a way to rasterize a 3d line to get altitude on raster
cells
crossed by the line ?

not quite sure what are you trying to do?

maybe:

v.drape:

Converts 2D vector features to 3D by sampling of elevation raster
map. ([https://grass.osgeo.org/grass82/manuals/v.drape.html](https://grass.osgeo.org/grass82/manuals/v.drape.html))
Additional vertices can be added to the input 2D vector map with
v.split.

or the something like:

v.fixed.segmentpoints - segment points along a vector line with
fixed distances
([https://grass.osgeo.org/grass82/manuals/addons/v.fixed.segmentpoints.html](https://grass.osgeo.org/grass82/manuals/addons/v.fixed.segmentpoints.html)
) followed by
v.what.rast - Uploads raster values at positions of vector points
to the table
([https://grass.osgeo.org/grass82/manuals/v.what.rast.html](https://grass.osgeo.org/grass82/manuals/v.what.rast.html)) or
v.sample - Samples a raster map at vector point locations
([https://grass.osgeo.org/grass82/manuals/v.sample.html](https://grass.osgeo.org/grass82/manuals/v.sample.html)).

kind regards
helmut

_______________________________________________
grass-user mailing list
[grass-user@lists.osgeo.org](mailto:grass-user@lists.osgeo.org)
[https://lists.osgeo.org/mailman/listinfo/grass-user](https://lists.osgeo.org/mailman/listinfo/grass-user)