pgLatLon
diff create_test_db.data.sql @ 10:684a78d2f9f0
Introduced lossy overlap operator (&&+) and fixed ecircle overlap searches on GiST-indexed ecluster columns
author | jbe |
---|---|
date | Fri Sep 02 14:08:01 2016 +0200 (2016-09-02) |
parents | 3b70e93cc07d |
children | 3cbce515387f |
line diff
1.1 --- a/create_test_db.data.sql Fri Sep 02 14:04:04 2016 +0200 1.2 +++ b/create_test_db.data.sql Fri Sep 02 14:08:01 2016 +0200 1.3 @@ -1,6 +1,24 @@ 1.4 1.5 -INSERT INTO "test" ("location", "area") SELECT 1.6 +CREATE OR REPLACE FUNCTION tmp_three_points() 1.7 + RETURNS epoint[] 1.8 + LANGUAGE plpgsql VOLATILE AS $$ 1.9 + DECLARE 1.10 + p1 epoint; 1.11 + p2 epoint; 1.12 + p3 epoint; 1.13 + BEGIN 1.14 + p1 := epoint((asin(2*random()-1) / pi()) * 180, (2*random()-1) * 180); 1.15 + p2 := epoint(latitude(p1) + (2*random()-1), longitude(p1) + cos(latitude(p1)/180*pi()) * (2*random()-1)); 1.16 + p3 := epoint(latitude(p1) + (2*random()-1), longitude(p1) + cos(latitude(p1)/180*pi()) * (2*random()-1)); 1.17 + RETURN ARRAY[p1, p2, p3]; 1.18 + END; 1.19 + $$; 1.20 + 1.21 +INSERT INTO "test" ("location", "surrounding", "multipoint", "triangle") SELECT 1.22 epoint((asin(2*random()-1) / pi()) * 180, (2*random()-1) * 180), 1.23 - ecircle((asin(2*random()-1) / pi()) * 180, (2*random()-1) * 180, -ln(1-random()) * 1000) 1.24 + ecircle((asin(2*random()-1) / pi()) * 180, (2*random()-1) * 180, -ln(1-random()) * 1000), 1.25 + ecluster_create_multipoint(tmp_three_points()), 1.26 + ecluster_create_polygon(tmp_three_points()) 1.27 FROM generate_series(1, 10000); 1.28 1.29 +DROP FUNCTION tmp_three_points();