Last active
June 2, 2016 22:48
-
-
Save eoghanmurray/a3068ee3e5040d879ecc9bc121545e30 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- postgresql-9.5-postgis-2.2 | |
create table test (name character varying, p geometry(point, 900913), a geometry(Geometry, 900913)); | |
insert into test values ('a', '010100002031BF0D00713D0AD7F54711C1A4703D1A3D965941', null); | |
insert into test values ('b', '010100002031BF0D0002FB34FAC62E11C1FAF7FB8141965941', '010300002031BF0D00010000000D0000009A9999998B3211C114AE47F13D965941295C8FC2863211C1A4703D5A569659418FC2F528D33011C1EC51B84E5A9659417B14AE47B62F11C1B81E851B5A965941295C8FC2BC2F11C18FC2F5F85D96594114AE47E10D2C11C1295C8FE26F965941EC51B81EF32B11C1666666D6699659417B14AE47D12C11C1F6285CFF139659418FC2F528BA2F11C1F6285C7F14965941B81E85EBBE2F11C11F85EB01279659415C8FC2F5DB2F11C1D7A3702D2C965941F6285C8F2F3011C15C8FC235309659419A9999998B3211C114AE47F13D965941'); | |
select name, st_contains(ST_CollectionHomogenize(c.g), u.p) | |
from test u, | |
(select unnest(st_clusterwithin(coalesce(u2.a, st_expand(u2.p, 350)), 250)) g | |
from test u2) c order by name; | |
name | st_contains | |
------+------------- | |
a | t | |
a | f | |
b | t | |
b | t | |
(4 rows) | |
create temporary table test_g as select unnest(st_clusterwithin(coalesce(a, st_expand(p, 350)), 250)) g from test; | |
select name, st_contains(ST_CollectionHomogenize(c.g), u.p) | |
from test u, test_g c order by name; | |
osm_gb-# name | st_contains | |
------+------------- | |
a | f | |
a | f | |
b | t | |
b | t | |
(4 rows) | |
-- Neither of these outputs appear to be correct, should have one true and one false row each for both a and b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment