[GIS] Consistent Errors with QGIS using GRASS tools

grassqgis

I have recently started using QGIS after using Arc for years. I downloaded QGIS Madeira 3.4.3 and have been working with road layers. After working with my project for a month in QGIS, I started trying to use some of the installed GRASS tools. Every single GRASS tool returns an error (will talk more specifically about what this is later). I searched stack exchange high and low, with no luck.

My first hunch was that there was something funky with the CRS. However, after setting the data frame's CRS to the layers, nothing changed. I then read that GRASS needs access to your .gdal folder for CRS information. I created a system variable to allow for GRASS to access the file, but there wasn't anything in the .gdal file that appeared to have CRS information. Anyway, that changed nothing.

I uninstalled and reinstalled QGIS with GRASS and GDAL using the OSgeo4 installer. Everything works great except the GRASS tools still. I have checked my topology using the check validity tool multiple times and fixed all errors.

I am trying to use v.net.distance to calculate the least cost path between points and polygons via a road layer, as it is the only tool that can use three different datasets to calculate distance and cost. When I run the tool, I get this message:

WARNING: Unable to open vector map on level 2. Try to rebuild vector topology with v.build

When I run v.build.check, I get:

WARNING: Unable to determine input map's vector feature type(s).
WARNING: No attribute table found -> using only category numbers as attributes

To check the validity of my layers, I opened a blank map with the correct CRS and ran the Shortest Path tool from different points all over the map. It worked just fine. I then ran a whole host of other GRASS tools, and they all returned similar errors to the v.build.check errors. The problem must be something structural in the system setup as opposed to a topology error in my files.

I have been searching and searching for so long on this.

Best Answer

When I run v.build.check, I get:

WARNING: Unable to determine input map's vector feature type(s). WARNING: No attribute table found -> using only category numbers as attributes

The v.build.check algorithm simplifies the execution of some GRASS functions:

g.proj -c proj4="+proj=longlat +datum=WGS84 +no_defs"
v.in.ogr min_area=0.0001 snap=-1.0 input="D:\a-folder\a-layer-file.shp" layer="a-layer-name" output="vector_5c2d30d9d13569" --overwrite -o
g.region n=90.0 s=-90.0 e=180.0 w=-180.0
v.build -e map=vector_5c2d30d9d13569 error=errore3d9a3b140e544858205d7609e40ce88 --overwrite
v.out.ogr -c type="auto" input="errore3d9a3b140e544858205d7609e40ce88" output="C:\Users\MyUser\AppData\Local\Temp\processing_546e3a62f29740018fb5e979e41e7ebb\73ab30660c314a27a97e2b609f74d441\error.gpkg" format="GPKG" --overwrite  

You can read the manual of each function used by the algorithm: g.proj, v.in.ogr, g.region, v.build, and v.out.ogr.

Precisely, these warnings are issued by the v.out.ogr function when no topology was created by v.build -e (that is, it didn't find topological errors in the analyzed layer):

Checking for topological errors...
0..2..4..6..8..10..12..14..16..18..20..22..24..26..28..30..32..34..36..38..40..42..44..46..48..50..52..54..56..58..60..62..64..66..68..70..72..74..76..78..80..82..84..86..88..90..92..94..96..98..100
Building topology for vector map <errore3d9a3b140e544858205d7609e40ce88@PERMANENT>...
Registering primitives...
0 primitives registered
0 vertices registered
Building areas...
100
0 areas built
0 isles built
Attaching islands...
Attaching centroids...
Number of nodes: 0
Number of primitives: 0
Number of points: 0
Number of lines: 0
Number of boundaries: 0
Number of centroids: 0
Number of areas: 0
Number of isles: 0
C:\PROGRA~1\QGIS3~1.4\bin>v.out.ogr -c type="auto" input="errore3d9a3b140e544858205d7609e40ce88" output="C:\Users\MyUser\AppData\Local\Temp\processing_546e3a62f29740018fb5e979e41e7ebb\73ab30660c314a27a97e2b609f74d441\error.gpkg" format="GPKG" --overwrite
WARNING: Unable to determine input map's vector feature type(s).
WARNING: No attribute table found -> using only category numbers as attributes
WARNING: Output layer is empty, no features written
v.out.ogr complete. 0 features (Unknown (any) type) written to <errore3d9a3b140e544858205d7609e40ce88> (GPKG format).  

I would think it's an expected behavior, at least in this case, and you should not worry about those warnings, other than knowing that v.out.ogr had nothing to export.


When I run the (v.net.distance) tool, I get this message:

WARNING: Unable to open vector map on level 2. Try to rebuild vector topology with v.build

In the case of v.net.distance we should see what is the particular situation in which it returns that warning. Note that it does not refer to the v.build.check algorithm but to the GRASS v.build function that Creates topology for vector map. It may be appropriate to start a new question for that warning by attaching the data set that produces it. Also, I leave a link to the manual.

Related Question