New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Processing] GRASS fix all ext scripts #5968
Conversation
@medspx Thanks for this. Do you have any ability to test on MacOS? I still (as of about a week ago when I last tested) can't get any GRASS algs to run on Mac. |
@timlinux , maybe not entirely a mac-only issue, I've also not been able to run most GRASS algorithms on my Ubuntu machine, including simple ones like v.clean. I'll paste the log output here later today. |
Try this:
Over here, both the errors and the cleaned layers are empty. The algorithm log output is as follow: Processing algorithm... Algorithm 'v.clean - Toolset for cleaning topology of vector map.' starting... Input parameters: { 'input' : '/home/webmaster/Desktop/grass/simple.shp', 'type' : [0,1,2,3,4,5,6], 'tool' : [0], 'threshold' : '', '-b' : False, '-c' : False, 'output' : '/tmp/processing_171788030d40465b93b88dab4baa6cb2/ecd720aaa419426298568db11e9cb80a/output.shp', 'error' : '/tmp/processing_171788030d40465b93b88dab4baa6cb2/ffd66b191a3a405bbfd3a950d3ef3adf/error.shp', 'GRASS_REGION_PARAMETER' : '', 'GRASS_SNAP_TOLERANCE_PARAMETER' : -1, 'GRASS_MIN_AREA_PARAMETER' : 0.0001, 'GRASS_OUTPUT_TYPE_PARAMETER' : 0 } g.proj -c proj4="+proj=utm +zone=48 +a=6377276.345 +b=6356075.41314024 +towgs84=198,881,317,0,0,0,0 +units=m +no_defs" v.external input="/home/webmaster/Desktop/grass/simple.shp" output="a5a4b066781d323" --overwrite -o g.region n=1541456.0 s=1524973.0 e=736925.0 w=726973.0 v.clean input=a5a4b066781d323 type="point" tool="break" output=outputc9e7d32f3fce4fc9a5a15fb3c5f7aed5 error=errorc9e7d32f3fce4fc9a5a15fb3c5f7aed5 --overwrite v.out.ogr -c type=auto input="outputc9e7d32f3fce4fc9a5a15fb3c5f7aed5" output="/tmp/processing_171788030d40465b93b88dab4baa6cb2/ecd720aaa419426298568db11e9cb80a/output.shp" format=ESRI_Shapefile --overwrite v.out.ogr -c type=auto input="errorc9e7d32f3fce4fc9a5a15fb3c5f7aed5" output="/tmp/processing_171788030d40465b93b88dab4baa6cb2/ffd66b191a3a405bbfd3a950d3ef3adf/error.shp" format=ESRI_Shapefile --overwrite Cleaning up temporary files... access: No such file or directory ERROR: LOCATION not available Starting GRASS GIS... Executing ... Default region was updated to the new projection, but if you have multiple mapsets `g.region -d` should be run in each to update the region from the default Projection information updated Building topology for vector map ... Using external data format 'ESRI Shapefile' (feature type 'polygon') Registering primitives... 6 primitives registered 154 vertices registered Number of nodes: 5 Number of primitives: 6 Number of points: 0 Number of lines: 0 Number of boundaries: 5 Number of centroids: 1 Number of areas: 5 Number of isles: 5 v.external complete. Link to vector map created. -------------------------------------------------- Tool: Threshold Break: 0 -------------------------------------------------- Copying features... 16..33..50..66..83..100 DBMI-SQLite driver error: Unable to create index: create unique index if not exists outputc9e7d32f3fce4fc9a5a15fb3c5f7aed5_ on outputc9e7d32f3fce4fc9a5a15fb3c5f7aed5 ( ) near ")": syntax error DBMI-SQLite driver error: Unable to create index: create unique index if not exists outputc9e7d32f3fce4fc9a5a15fb3c5f7aed5_ on outputc9e7d32f3fce4fc9a5a15fb3c5f7aed5 ( ) near ")": syntax error WARNING: Unable to create index WARNING: Unable to copy table for layer 1 from to WARNING: Failed to copy attribute table to output vector map Rebuilding parts of topology... Building topology for vector map ... Registering primitives... 6 primitives registered 155 vertices registered Number of nodes: 5 Number of primitives: 6 Number of points: 0 Number of lines: 0 Number of boundaries: 5 Number of centroids: 1 Number of areas: - Number of isles: - -------------------------------------------------- Tool: Break lines at intersections -------------------------------------------------- Rebuilding topology for output vector map... Building topology for vector map ... Registering primitives... 6 primitives registered 155 vertices registered Building areas... 0..16..33..50..66..83..100 5 areas built 5 isles built Attaching islands... 20..40..60..80..100 Attaching centroids... 16..33..50..66..83..100 Number of nodes: 5 Number of primitives: 6 Number of points: 0 Number of lines: 0 Number of boundaries: 5 Number of centroids: 1 Number of areas: 5 Number of isles: 5 -------------------------------------------------- Building topology for error vector map... Building topology for vector map ... 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 WARNING: The map contains islands. With the -c flag, islands will appear as filled areas, not holes in the output map. ERROR: Key column <> not found 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 (ESRI_Shapefile format). Execution of finished. Cleaning up temporary files... Execution completed in 0.26 seconds Results: {'error': , 'output': } Loading resulting layers Algorithm 'v.clean - Toolset for cleaning topology of vector map.' finished |
Hello, @nirvn It was just a problem with v.external which doesn't work properly for v.clean. You just have to modify the configuration settings to disable v.external in Settings -> Options -> Processing -> Providers -> GRASS -> use v.external. I have also disabled v.external by default with the latest commit, just in case (actually it is already disabled by default in #5726 which is not merged for the moment). When it is disabled, I have (some) results with v.clean on your data (note the use of v.in.ogr instead of v.external in the logs):
|
@timlinux Hello, I am really sorry, I don't have a Mac for the tests (and debugging). I assumed that it was a POSIX OS and that I could use the same code and options than for GNU/Linux distributions. But it seems that it is not the case. Can someone else help with this issue? |
@medspx , I've tested this PR, working nicely, and v.clean (as well as a bunch of other operations) are now working with the new default settings. @nyalldawson , we should probably merge this fix ASAP. |
I'll let @alexbruy do that |
Description
This PR fixes all the Python scripts in the ext/ directory of the GRASS Processing provider.
The scripts are provided in order to properly handle the internal logic of some algorithms (well a lot of algorithms actually). For example, if you want to use v.net.iso you have to build an internal GRASS vector with two layers (one for the network and the other for the center points). There is no mechanism in QGIS to build this special vector so you have to build it before really using v.net.iso. The ext script just do it for you so you only have to provide one line vector layer for the network and one point layer for the center points, directly from QGIS.
I have also improved Grass7Algorithm.py (the main algorithm handling code for the provider) by adding support for some specific cases. Some description files where also broken and I have updated them.
When this PR will be merged in master, the GRASS Processing provider will be at (about) the same level than in QGIS 2.x.
However, I have discarded some (or specific options for) algorithms:
Checklist
fixes #11111
in the commit message next to the description[FEATURE]
in the commit message[needs-docs]
in the commit message and containt sufficient information in the commit message to be documentedscripts/prepare-commit.sh
script before each commit