Hi,
I'm trying to write my first Grass python script to load Shape files and delete all lines shorter than 50m
I'm trying various permutations of the command below, but no success (No error message and no lines deleted).
Any guidance would be welcome.
On Sat, Nov 30, 2019 at 4:05 PM Zoltan Szecsei <zoltans@geograph.co.za> wrote:
Hi,
I'm trying to write my first Grass python script to load Shape files and
delete all lines shorter than 50m
I'm trying various permutations of the command below, but no success
(No error message and no lines deleted).
Any guidance would be welcome.
Hi,
I’m trying to write my first Grass python script to load Shape files and delete all lines shorter than 50m
I’m trying various permutations of the command below, but no success (No error message and no lines deleted).
Any guidance would be welcome.
In [4]: where_expr = "%s > %d" % ("'length'", 5000)
In [5]: where_expr Out[5]: "'length' > 5000"
In [6]: gscript.run_command('v.extract', input="roads", output="roads_long", where=where_expr) Data element 'vector/roads' was found in more mapsets (also found in <PERMANENT>) Using <roads@Arava>... Data element 'vector/roads' was found in more mapsets (also found in <PERMANENT>) Using <roads@Arava>... Extracting features... 100% Building topology for vector map <roads_long@Arava>... Registering primitives... Writing attributes... Out[6]: 0
Note the quoting around the column header “length”: One double quote and one single quote. The inner single quote is for the SQL expression.
Cheers, Micha
Thanks and regards,
Zoltan
PS: Should these type of questions go to grass-dev ??
Hi,
I'm trying to write my first Grass python script to load Shape files and delete all lines shorter than 50m
I'm trying various permutations of the command below, but no success (No error message and no lines deleted).
Any guidance would be welcome.
Note the triplet value for Threshold.
Thanks again,
Zoltan
On 2019/11/30 18:43, Markus Neteler wrote:
Hi Zoltan,
On Sat, Nov 30, 2019 at 4:05 PM Zoltan Szecsei <zoltans@geograph.co.za> wrote:
Hi,
I'm trying to write my first Grass python script to load Shape files and
delete all lines shorter than 50m
I'm trying various permutations of the command below, but no success
(No error message and no lines deleted).
Any guidance would be welcome.