Hi, Simon,
I think that it is worthwhile to make it work as a function.
Regards, David

On Fri, 3 Dec 2021 at 00:29, Simon G Greener <[email protected]>
wrote:

> 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 
> [email protected]https://lists.osgeo.org/mailman/listinfo/postgis-users
>
> _______________________________________________
> postgis-users mailing list
> [email protected]
> https://lists.osgeo.org/mailman/listinfo/postgis-users
>
_______________________________________________
postgis-users mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/postgis-users

Reply via email to