v.fill.holes(1grass)
π v.fill.holes π
okay bestie, gather round, because we're talking about v.fill.holes β that's the GRASS manual page, and it's literally the "fill holes in areas by keeping only outer boundaries" girlie. she's from the GRASS User's Manual and she is so good at what she does. no cap. π³οΈβ‘οΈβ¨
β¨ KEYWORDS β¨
vector, geometry, fill, exterior, ring, perimeter π
πΈ SYNOPSIS πΈ
v.fill.holes
v.fill.holes --help
v.fill.holes input=name [layer=string] [cats=range]
[where=sql_query] output=name [--overwrite] [--help] [--verbose]
[--quiet] [--ui]
π Flags π
--overwriteβ bestie this lets your output files just overwrite existing files. rude but useful π--helpβ prints the usage summary, aka the cheat sheet π«Ά--verboseβ verbose module output, she's chatty, she tells you everything π--quietβ quiet module output, she says nothing, she's mysterious π¦--uiβ force launching the GUI dialog, for when you want the pretty buttons β¨
π Parameters π
input=name[required] β Name of input vector map. Or, plot twist, the data source for direct OGR access πlayer=stringβ Layer number or name. so like, vector features can have category values in different layers, and this number decides which layer to use. when you're doing direct OGR access, this is the layer name instead. Default:1βcats=rangeβ Category values. Example:1,3,7-9,13πwhere=sql_queryβ WHERE conditions of SQL statement, nowherekeyword needed. Example:income < 1000 and population >= 10000πoutput=name[required] β Name for output vector map π
π DESCRIPTION π
okay so v.fill.holes fills empty spaces inside areas. specifically β and this is the important part β it preserves areas that have centroids, while areas without centroids (which typically represent holes) get removed. periodt. π³οΈβ
the way that it works: v.fill.holes goes over all areas in a vector map and preserves only the outer boundaries of each area, while removing inner boundaries which are considered holes. the holes become part of the area which contained them. and listen β no boundaries of these holes are preserved. none. zero. gone. π€
Figure: Holes inside areas are removed. (a) Original areas with holes and (b) the same areas but with holes filled. πΌοΈ
so here's a lil situation that might trip you up: in case areas have empty space in between them, i.e., there are holes in the overall coverage, but not in the areas themselves β v.fill.holes can't assign this empty space to either of these areas, because it does not know which area this empty space should belong to. tragic, ik. π
if that space genuinely needs to be filled, you resolve it by merging the areas around the empty space into one, by dissolving their common boundaries. this turns the empty space into a hole inside one single area, which turns the whole situation into a case of one area with a hole. slay, problem solved. π
Figure: Empty space in between two areas does not belong to either area, so it is filled only after the boundaries between areas are dissolved, i.e., areas merged into one. (a) Original areas with space in between, (b) one area with a hole after dissolving the common boundary, and (c) hole filled. πΌοΈ
π¦ Topology π¦
strictly speaking β and nerd hat ON β in the GRASS topological model, an area is a closed boundary (or a series of connected closed boundaries) which may have a centroid. π§
if it has a centroid, it is rendered as a filled area in displays, and this is what is usually considered an area from the user perspective. these are the areas where v.fill.holes preserves the associated outer boundary (or boundaries). π«
other closed boundaries, i.e., those without a centroid, are not carried over to the output. and all other features are removed too, including points and lines. no survivors, bestie. π
π Attributes π
if a specific layer is selected, attributes for that layer are preserved for the areas, based on the category or categories associated with each area. by default, layer number 1 is selected. β
in case there are attribute tables associated with other layers, or attributes associated with categories of other features than areas with centroids β this attribute data is not carried over to the output, just like the corresponding geometries. it's giving "you lose what you don't bring" πΈ
π EXAMPLE π
the lakes vector map in the North Carolina sample dataset represents islands inside lakes as areas distinguished by attributes. to demonstrate v.fill.holes, we will first extract only the lakes, which will create holes where the islands were located. then we'll fill the holes created in the lakes to get the whole perimeter of the lakes including islands. ποΈ
remove the islands by extracting everything else (results in holes):
v.extract input=lakes where="FTYPE != 'ROCK/ISLAND'" output=lakes_only
remove the holes:
v.fill.holes input=lakes_only output=lakes_filled
Figure: The filled lake (blue) and borders of the original lakes with islands removed (light blue). Figure shows a smaller area in the north of the data extent. πΌοΈ
π SEE ALSO π
v.dissolvefor removing common boundaries based on attributes, πv.cleanfor removing topological issues, π§Όr.fillnullsfor filling empty spaces in raster maps using interpolation, πr.fill.statsfor filling empty spaces in raster maps using statistics. π
π AUTHOR π
Vaclav Petras, NCSU Center for Geospatial Analytics, GeoForAll Lab π
π SOURCE CODE π
Available at: v.fill.holes source code (history)
Latest change: Friday Jun 20 15:13:04 2025 in commit: 9dd92f956684722d9ad0ff5f3e724b92cb8e1a5b π
Main index | Vector index | Topics index | Keywords index | Graphical index | Full index ποΈ
okay and that's the whole page, bestie!! π«Ά GRASS 8.5.0, Β© 2003-2026 GRASS Development Team, straight outta the GRASS 8.5.0 Reference Manual β mwah, iconic, no notes. ππβ¨
π¦ where this page comes from
- alpine 3.24: grass-gis-doc 8.5.0-r1 Β· GPL-2.0-or-later
- ubuntu stonking: grass-doc 8.5.0-1ubuntu1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms