integration test demo
This commit is contained in:
parent
f3961d8084
commit
9bce5b61a9
@ -78,11 +78,11 @@ linijinių objektų generalizacijai (Lietuvoje -- GDR50 ir GDR250 analogus)
|
|||||||
|
|
||||||
# Tolimesnis pritaikymas
|
# Tolimesnis pritaikymas
|
||||||
|
|
||||||
Sukurta algoritmo techninė realizacija atviro kodo GIS bus pradžia tolesniam jo
|
- Sukurta algoritmo techninė realizacija atviro kodo GIS bus pradžia tolesniam jo
|
||||||
pritaikymui kitiems gamtiniams objektams: ežerų kranto linija, jūrų,
|
pritaikymui kitiems gamtiniams objektams: ežerų kranto linija, jūrų,
|
||||||
kontinentų, miškų ribos.
|
kontinentų, miškų ribos.
|
||||||
|
|
||||||
Kadangi rezultatas bus techninė realizacija, o ne rašinėlis, tai suteikia
|
- Kadangi rezultatas bus techninė realizacija, o ne rašinėlis, tai suteikia
|
||||||
toliau galimybę vystyti sprendimą.
|
toliau galimybę vystyti sprendimą.
|
||||||
|
|
||||||
# Demonstracija
|
# Demonstracija
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
\i wm.sql
|
\i wm.sql
|
||||||
|
|
||||||
drop table if exists agg_rivers_wm;
|
drop table if exists debug_wm;
|
||||||
create table agg_rivers_wm (name text, way geometry);
|
create table debug_wm(name text, way geometry, props json);
|
||||||
insert into agg_rivers_wm (name, way) select name, ST_SimplifyWM(way, true) from agg_rivers;
|
|
||||||
|
drop table if exists demo_wm;
|
||||||
|
create table demo_wm (name text, i bigint, way geometry);
|
||||||
|
insert into demo_wm (name, way) select name, ST_SimplifyWM(way, true) from agg_rivers;
|
||||||
|
12
IV/wm.sql
12
IV/wm.sql
@ -276,7 +276,13 @@ begin
|
|||||||
fourpi = 4*radians(180);
|
fourpi = 4*radians(180);
|
||||||
for i in 1..array_length(bends, 1) loop
|
for i in 1..array_length(bends, 1) loop
|
||||||
bend = bends[i];
|
bend = bends[i];
|
||||||
|
if st_numpoints(bend) < 3 then
|
||||||
|
cmp = 0;
|
||||||
|
area = 0;
|
||||||
|
polygon = null;
|
||||||
|
else
|
||||||
select st_makepolygon(st_addpoint(bend, st_startpoint(bend))) into polygon;
|
select st_makepolygon(st_addpoint(bend, st_startpoint(bend))) into polygon;
|
||||||
|
end if;
|
||||||
-- Compactness Index (cmp) is defined as "the ratio of the area of the
|
-- Compactness Index (cmp) is defined as "the ratio of the area of the
|
||||||
-- polygon over the circle whose circumference length is the same as the
|
-- polygon over the circle whose circumference length is the same as the
|
||||||
-- length of the circumference of the polygon". I assume they meant the
|
-- length of the circumference of the polygon". I assume they meant the
|
||||||
@ -285,15 +291,17 @@ begin
|
|||||||
-- 2. get polygon perimeter = u. Pretend it's our circle's circumference.
|
-- 2. get polygon perimeter = u. Pretend it's our circle's circumference.
|
||||||
-- 3. get A (area) of the circle from circumference u := (u^2)/(4*pi)
|
-- 3. get A (area) of the circle from circumference u := (u^2)/(4*pi)
|
||||||
-- 4. divide area by A: cmp = P/((u^2)*4*pi) = 4*pi*P/u^2
|
-- 4. divide area by A: cmp = P/((u^2)*4*pi) = 4*pi*P/u^2
|
||||||
|
if polygon is not null then
|
||||||
select st_area(polygon) into area;
|
select st_area(polygon) into area;
|
||||||
select fourpi*area/(st_perimeter(polygon)^2) into cmp;
|
select fourpi*area/(st_perimeter(polygon)^2) into cmp;
|
||||||
if cmp > 0 then
|
end if;
|
||||||
|
if area > 0 then
|
||||||
select (area*(0.75/cmp)) into adjsize;
|
select (area*(0.75/cmp)) into adjsize;
|
||||||
end if;
|
end if;
|
||||||
if dbg then
|
if dbg then
|
||||||
insert into debug_wm (name, way, props) values(
|
insert into debug_wm (name, way, props) values(
|
||||||
'bend_attrs_' || i,
|
'bend_attrs_' || i,
|
||||||
polygon,
|
bend,
|
||||||
json_build_object('area', area, 'cmp', cmp, 'adjsize', adjsize)
|
json_build_object('area', area, 'cmp', cmp, 'adjsize', adjsize)
|
||||||
);
|
);
|
||||||
end if;
|
end if;
|
||||||
|
Loading…
Reference in New Issue
Block a user