Skip to content

Commit 19d322c

Browse files
committed
r.in.vect: new heatmap (count overlapping features) added
1 parent f9e94e9 commit 19d322c

File tree

3 files changed

+258
-88
lines changed

3 files changed

+258
-88
lines changed

src/raster/r.in.vect/r.in.vect.html

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,28 @@ <h2>DESCRIPTION</h2>
2424
used as raster values in the output raster map.
2525

2626
<p>
27-
Optionally, only features selected with the <b>where</b> option can be
28-
imported.
27+
Setting the <b>-c</b> flag counts the number of overlapping features per pixel
28+
and assigns that count as the raster value, effectively creating a heatmap.
29+
30+
<p>
31+
Optionally, only features selected with the <b>where</b> or <b>sql</b> option
32+
can be imported.
2933

3034
<h2>Notes</h2>
3135

3236
By default, <em>r.in.vect</em> will only affect data in areas lying
3337
inside the boundaries of the current computational region. Before
3438
running the function, users should therefore ensure that the
3539
computational region is correctly set, and that the region's resolution
36-
is at the desired level. Alternatively, users can use the <b>-v</b>
37-
flag to set the exent of the raster layer to that of the vector layer.
38-
To ensure that the resulting raster map cleanly aligns with the
39-
computational region, the extent may be slightly larger than that of
40-
the vector layer.
40+
is at the desired level.
41+
42+
<p>
43+
Alternatively, use the <b>-v</b> flag to import the entire vector extent,
44+
ignoring the current region boundaries. By default, this produces a full-map
45+
raster without modifying the current computational region. To update the region
46+
to match the imported raster, include the <b>-r</b> flag. This extends the
47+
region bounds to encompass the new layer while ensuring the grid remains aligned
48+
with the existing resolution.
4149

4250
<p>
4351
If the coordinate reference system (CRS) of the vector file differs
@@ -117,13 +125,14 @@ <h3>Example 2</h3>
117125
r.in.vect input=geology.gpkg \
118126
output=geology_rast2 \
119127
attribute_column=GEOL250_ \
120-
rat_column=GEO_NAME
128+
label_column=GEO_NAME
121129
memory=2000
122130

123131
# Assign random colors
124132
r.colors map=geology_rast2 color=random
125133
</pre></div>
126134

135+
<p>
127136
<div align="left" style="margin: 10px"> <a href="r_in_vect_im02.png">
128137
<img src="r_in_vect_im02.png" alt="The geology vector file converted
129138
to, and imported as raster in GRASS GIS. Example 2" border="0">
@@ -157,6 +166,7 @@ <h3>Example 3</h3>
157166
memory=2000
158167
</pre></div>
159168

169+
<p>
160170
<div align="left" style="margin: 10px"> <a href="r_in_vect_im03.png">
161171
<img src="r_in_vect_im03.png" alt="The busroute6 vector file converted
162172
to raster and imported into GRASS GIS. Example 3" border="0">
@@ -178,6 +188,7 @@ <h3>Example 4</h3>
178188
memory=2000
179189
</pre></div>
180190

191+
<p>
181192
<div align="left" style="margin: 10px"> <a href="r_in_vect_im04.png">
182193
<img src="r_in_vect_im04.png" alt="The busroute6 vector file converted
183194
to raster and imported into GRASS GIS. Example 4" border="0">
@@ -194,6 +205,9 @@ <h2>SEE ALSO</h2>
194205

195206
<h2>AUTHORS</h2>
196207

197-
Paulo van Breugel (<a href="https://ecodiv.earth">ecodiv.earth</a>)<br>
198-
Applied Geo-information Sciences<br> <a href="https://www.has.nl/">HAS
199-
green academy, University of Applied Sciences</a><br>
208+
Paulo van Breugel | <a href="https://has.nl">HAS green academy</a>,
209+
University of Applied Sciences | <a
210+
href="https://www.has.nl/en/research/professorships/climate-robust-landscapes-professorship/">Climate-robust
211+
Landscapes research group</a> |
212+
<a href="https://www.has.nl/en/research/professorships/innovative-bio-monitoring-professorship/">Innovative Bio-Monitoring research group</a> |
213+
Contact: <a href="https://ecodiv.earth">Ecodiv.earth</a>

src/raster/r.in.vect/r.in.vect.md

Lines changed: 45 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -14,43 +14,49 @@ intermediate geoTIF file (using
1414
[gdal.rasterize](https://gdal.org/api/python/utilities.html#osgeo.gdal.Rasterize))
1515
and imports it into GRASS GIS.
1616

17-
The objects in the vector map will be assigned an user-defined value
18-
using the **value** parameter. Alternatively, the user can use the
19-
**attribute\_column** to specify the name of an existing column from the
20-
vector map's attribute table. The values in that column will be used as
21-
raster values in the output raster map.
17+
The objects in the vector map will be assigned an user-defined value using the
18+
**value** parameter. Alternatively, the user can use the **attribute_column** to
19+
specify the name of an existing column from the vector map's attribute table.
20+
The values in that column will be used as raster values in the output raster
21+
map.
2222

23-
Optionally, the only features selected with the **where** option can be
23+
Setting the **-c** flag counts the number of overlapping features per pixel and
24+
assigns that count as the raster value, effectively creating a heatmap.
25+
26+
Optionally, only features selected with the **where** or **sql** option can be
2427
imported.
2528

2629
## Notes
2730

2831
By default, *r.in.vect* will only affect data in areas lying inside the
29-
boundaries of the current computational region. Before running the
30-
function, users should therefore ensure that the computational region is
31-
correctly set, and that the region's resolution is at the desired level.
32-
Alternatively, users can use the **-v** flag to set the exent of the
33-
raster layer to that of the vector layer. To ensure that the resulting
34-
raster map cleanly aligns with the computational region, the extent may
35-
be slightly larger than that of the vector layer.
36-
37-
If the coordinate reference system (CRS) of the vector file differs from
38-
that of the mapset in which users want to import the raster, the vector
39-
file will be first reprojected using *ogr2ogr*.
40-
41-
The **label\_column** parameter can be used to assign raster category
42-
labels. Users should check if each unique value from the category column
43-
has one corresponding label in the label column. If there are categories
44-
with more than one label, the first from the label column will be used
45-
(and a warning will be printed).
46-
47-
With the **-d** flag, all pixels touched by lines or polygons will be
48-
updated, not just those on the line render path, or which center point
49-
is within the polygon. For lines, this is similar to setting the **-d**
50-
flag in *v.to.rast*.
51-
52-
For simple and small vector layers, it is probably faster to
53-
import the vector layer first and converting it to a raster in GRASS.
32+
boundaries of the current computational region. Before running the function,
33+
users should therefore ensure that the computational region is correctly set,
34+
and that the region's resolution is at the desired level.
35+
36+
Alternatively, use the **-v** flag to import the entire vector extent, ignoring
37+
the current region boundaries. By default, this produces a full-map raster
38+
without modifying the current computational region. To update the region to
39+
match the imported raster, include the **-r** flag. This extends the region
40+
bounds to encompass the new layer while ensuring the grid remains aligned with
41+
the existing resolution.
42+
43+
If the coordinate reference system (CRS) of the vector file differs from that of
44+
the mapset in which users want to import the raster, the vector file will be
45+
first reprojected using *ogr2ogr*.
46+
47+
The **label_column** parameter can be used to assign raster category labels.
48+
Users should check if each unique value from the category column has one
49+
corresponding label in the label column. If there are categories with more than
50+
one label, the first from the label column will be used (and a warning will be
51+
printed).
52+
53+
With the **-d** flag, all pixels touched by lines or polygons will be updated,
54+
not just those on the line render path, or which center point is within the
55+
polygon. For lines, this is similar to setting the **-d** flag in *v.to.rast*.
56+
57+
For simple and small vector layers, it is probably faster to import the vector
58+
layer first and converting it to a raster in GRASS.
59+
5460

5561
## EXAMPLE
5662

@@ -101,7 +107,7 @@ values.
101107
r.in.vect input=geology.gpkg \
102108
output=geology_rast2 \
103109
attribute_column=GEOL250_ \
104-
rat_column=GEO_NAME
110+
label_column=GEO_NAME
105111
memory=2000
106112

107113
# Assign random colors
@@ -166,7 +172,10 @@ gaps or lines that consist of cells that are only diagonally connected.*
166172

167173
## AUTHORS
168174

169-
Paulo van Breugel ([ecodiv.earth](https://ecodiv.earth))
170-
Applied Geo-information Sciences
171-
[HAS green academy, University of Applied
172-
Sciences](https://www.has.nl/)
175+
Paulo van Breugel | [HAS green academy](https://has.nl), University of
176+
Applied Sciences | [Climate-robust Landscapes research
177+
group](https://www.has.nl/en/research/professorships/climate-robust-landscapes-professorship/)
178+
| [Innovative Bio-Monitoring research
179+
group](https://www.has.nl/en/research/professorships/innovative-bio-monitoring-professorship/)
180+
| Contact: [Ecodiv.earth](https://ecodiv.earth)
181+

0 commit comments

Comments
 (0)