File: frechet.sql

package info (click to toggle)
postgis 3.3.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 87,748 kB
  • sloc: ansic: 158,671; sql: 91,546; xml: 54,004; cpp: 12,339; sh: 5,187; perl: 5,100; makefile: 3,085; python: 1,205; yacc: 447; lex: 151; javascript: 6
file content (31 lines) | stat: -rw-r--r-- 907 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
-- tests for Frechet distances

-- linestring and linestring
SELECT 'frechet_ls_ls', st_frechetdistance(
	'LINESTRING (0 0, 2 1)'::geometry
	, 'LINESTRING (0 0, 2 0)'::geometry);
-- 1.0

-- other linestrings
SELECT 'frechet_ls_ls_2', st_frechetdistance(
	'LINESTRING (0 0, 2 0)'::geometry,
	'LINESTRING (0 1, 1 2, 2 1)'::geometry)::numeric(12,6);
-- 2.23606797749979

-- linestring and multipoint
SELECT 'frechet_ls_mp', st_frechetdistance(
	'LINESTRING (0 0, 2 0)'::geometry,
	'MULTIPOINT (0 1, 1 0, 2 1)'::geometry);
-- 1.0

-- another linestring and linestring
SELECT 'frechet_ls_ls_3', st_frechetdistance(
	'LINESTRING (0 0, 100 0)'::geometry,
	'LINESTRING (0 0, 50 50, 100 0)'::geometry)::numeric(12,6);
-- 70.7106781186548

-- rechet with densification
SELECT 'frechetdensify_ls_ls', st_frechetdistance(
	'LINESTRING (0 0, 100 0)'::geometry,
	'LINESTRING (0 0, 50 50, 100 0)'::geometry, 0.5);
-- 50.0