[postgis-users] Is there a generic function to find coincident vertex?
Simon G Greener
simon at spatialdbadvisor.com
Thu Dec 2 16:19:06 PST 2021
Not that I am aware.
You could try wrapping something like the following SQL in a function....
with data as (
select 0.01 as tolerance,
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
)
select SUM(isDuplicate) as duplicateCount
from (select case when
ST_Distance(ST_PointN(a.geom,b.*),lead(ST_PointN(a.geom,b.*)) over
(order by b.*)) < a.tolerance
then 1
else 0
end as isDuplicate
from data as a,
generate_series(1,ST_NumPoints(a.geom),1) as b
) as f;
Note that if the linestring was a compoundCurve repeated vertices are
part of the definition.
regards
Simon
On 3/12/2021 9:46 am, Shaozhong SHI wrote:
>
> Is there a generic function to find coincident vertex and count?
>
>
> It will do the following:
>
>
> Create an array of all vertex present in a data set
>
> Iterate over and find out whether there be any coincident vertex as
> defined by a tolerance
>
> Count all occurrences
>
>
> Regards,
>
>
> David
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20211203/3871e43e/attachment.html>
More information about the postgis-users
mailing list