[GRASS-user] SOLVED: Re: deleting lines by length, from a vector map
zoltans at geograph.co.za
Sun Dec 1 04:26:13 PST 2019
Thanks go to Markus, Micha and Moritz for contribution.
Having been guided to v.edit, it was quite trivial:
gscript.run_command('v.edit', map=gen, type='line', tool='delete',
threshold='-1,0,-50', query='length', overwrite=True)
Note the triplet value for Threshold.
On 2019/11/30 18:43, Markus Neteler wrote:
> Hi Zoltan,
> On Sat, Nov 30, 2019 at 4:05 PM Zoltan Szecsei <zoltans at geograph.co.za> wrote:
>> 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.
>> gscript.run_command('v.extract','r',input=gen,output=lin, where="(
>> $LENGTH > 50 )",overwrite=True)
>> gscript.run_command('v.out.ogr', 'sce2', input=lin, type='line',
>> output=dir_rclout + rcl + '.shp', format='ESRI_Shapefile',
> (writing in a rush, just to send some ideas)
> Perhaps something like this:
> Delete selected features from vector map
> with the related WHERE condition.
> The attribute-from-geometry for this WHERE condition you may get with
> For the line lengths, perhaps to consider
>> Thanks and regards,
>> PS: Should these type of questions go to grass-dev ??
> Here is fine as well!
>> Zoltan Szecsei GPrGISc 0031
>> Geograph (Pty) Ltd.
>> GIS and Photogrammetric Services
>> P.O. Box 7, Muizenberg 7950, South Africa.
>> Mobile: +27-83-6004028 (WhatsApp only)
>> Qatar: +974 5083 2722 www.geograph.co.za
>> grass-user mailing list
>> grass-user at lists.osgeo.org
Zoltan Szecsei GPrGISc 0031
Geograph (Pty) Ltd.
GIS and Photogrammetric Services
P.O. Box 7, Muizenberg 7950, South Africa.
Mobile: +27-83-6004028 (WhatsApp only)
Qatar: +974 5083 2722 www.geograph.co.za
More information about the grass-user