File: alphashape-any.test

package info (click to toggle)
pgrouting 2.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 14,232 kB
  • ctags: 1,566
  • sloc: cpp: 74,626; ansic: 6,036; sql: 2,889; sh: 635; perl: 523; makefile: 67
file content (24 lines) | stat: -rw-r--r-- 1,174 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
--------------------------------------------------------------------------------
--              PGR_alphAShape
--------------------------------------------------------------------------------
-- testing with areas
--SELECT * FROM pgr_alphAShape('SELECT id, x, y FROM vertex_table');
--SELECT * FROM pgr_alphAShape('SELECT id::integer, st_x(the_geom)::float as x, st_y(the_geom)::float as y  FROM edge_table_vertices_pgr');

SELECT round(st_area(ST_MakePolygon(ST_AddPoint(foo.openline, ST_StartPoint(foo.openline))))::numeric, 2) as st_area
from (select st_makeline(points order by id)  as openline from
(SELECT st_makepoint(x,y) as points ,row_number() over() AS id 

FROM pgr_alphAShape('SELECT id, x, y FROM vertex_table')

) as a) as foo;

\echo '-----------------------------'

SELECT round(st_area(ST_MakePolygon(ST_AddPoint(foo.openline, ST_StartPoint(foo.openline))))::numeric, 2) as st_area
from (select st_makeline(points order by id)  as openline from
(SELECT st_makepoint(x,y) as points ,row_number() over() AS id 

FROM pgr_alphAShape('SELECT id::integer, st_x(the_geom)::float as x, st_y(the_geom)::float as y  FROM edge_table_vertices_pgr')

) as a) as foo;