Last active
September 16, 2016 01:27
-
-
Save rhysallister/bcb4bb07a99d69938fff88f150883bee to your computer and use it in GitHub Desktop.
blow out duplicate points to a circle
This file contains 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
with one as ( | |
select st_x(g),st_y(g), g,count(premises), array_agg(premises) from service.location | |
where g is not null | |
group by 1,2,3 | |
having count(premises) > 1 | |
order by 3 desc | |
) | |
,qq as | |
(select *, st_exteriorring(st_buffer(g,3,count::int/3)) gring, unnest(array_agg) from one ) | |
,tt as ( | |
select row_number() over (),*, st_pointn(gring,(row_number() over (partition by st_x,st_y))::int)jj from qq) | |
--select * from tt | |
update service.location set g = st_setsrid(jj,3448) | |
from tt where premises = unnest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment