<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="FR" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-GB">Dear GRASS users,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">I'm trying to simplify a watercourse polygon with v.generalize in a Python script running on a x64 Windows 10 machine. The script points to the GRASS 7.8.3 distribution shipped with QGIS 3.14.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Previously in QGIS, the v.generalize tool on the watercourse polygon with 'threshold' set to 100 produced the desired output, with 'Number of vertices for selected features reduced from 2323 to 30 (1% remaining)'.
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">In the Python script, using the same arguments, v.generalize gives:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">grass.run_command('v.generalize', input='watercourse', output='vgen _lothresh', type='area', method='douglas', threshold=100)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"> > 'Number of vertices for selected features reduced from 3249 to 1854 (57% remaining)'<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"> <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">which is not the same output. And changing the 'threshold' argument from 100 to 10000 has no effect on the output:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">grass.run_command('v.generalize', input='watercourse', output='vgen_hithresh', type='area', method='douglas', threshold=10000)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"> > 'Number of vertices for selected features reduced from 3249 to 1854 (57% remaining)'<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">In the Python script again, pointing to a standalone GRASS 7.8.3 or old stable 7.6.1 does not solve the problem, nor using other simplification methods.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">What am I doing wrong here? I would appreciate your support on this.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Thank you, best wishes<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Clement Poirier<o:p></o:p></span></p>
</div>
</body>
</html>