<div dir="ltr">Hi, Simon,<div>I think that it is worthwhile to make it work as a function.</div><div>Regards, David</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 3 Dec 2021 at 00:29, Simon G Greener <<a href="mailto:simon@spatialdbadvisor.com">simon@spatialdbadvisor.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<p>Not that I am aware.</p>
<p>You could try wrapping something like the following SQL in a
function....</p>
<p><font face="monospace">with data as (<br>
select 0.01 as tolerance,<br>
ST_GeomFromText('LINESTRING(0 0 1.1,1 1.001 1.2,1
1.0005 1.3,1 1 1.1,2 2 1.2)',0) as geom<br>
)<br>
select SUM(isDuplicate) as duplicateCount<br>
from (select case when
ST_Distance(ST_PointN(a.geom,b.*),lead(ST_PointN(a.geom,b.*))
over (order by b.*)) < a.tolerance<br>
then 1<br>
else 0<br>
end as isDuplicate<br>
from data as a,<br>
generate_series(1,ST_NumPoints(a.geom),1) as b<br>
) as f;</font><br>
</p>
<p>Note that if the linestring was a compoundCurve repeated vertices
are part of the definition.</p>
<p>regards</p>
<p>Simon<br>
</p>
<div>On 3/12/2021 9:46 am, Shaozhong SHI
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div dir="ltr">
<p class="MsoNormal">Is there a generic function to find
coincident vertex and count?</p>
<p class="MsoNormal"><br>
</p>
<p class="MsoNormal">It will do the following:</p>
<p class="MsoNormal"><br>
</p>
<p class="MsoNormal">Create an array of all vertex present in
a data set<span></span></p>
<p class="MsoNormal">Iterate over and find out whether there
be any coincident
vertex as defined by a tolerance<span></span></p>
<p class="MsoNormal">Count all occurrences<span></span></p>
<p class="MsoNormal"><br>
</p>
<p class="MsoNormal">Regards,</p>
<p class="MsoNormal"><br>
</p>
<p class="MsoNormal">David</p>
</div>
</div>
<br>
<fieldset></fieldset>
<pre>_______________________________________________
postgis-users mailing list
<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a>
<a href="https://lists.osgeo.org/mailman/listinfo/postgis-users" target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-users</a>
</pre>
</blockquote>
</div>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/postgis-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-users</a><br>
</blockquote></div>