Skip to content

Instantly share code, notes, and snippets.

@uekeueke
Created February 11, 2016 15:29
Show Gist options
  • Select an option

  • Save uekeueke/d9ddcc2faada06c80f5e to your computer and use it in GitHub Desktop.

Select an option

Save uekeueke/d9ddcc2faada06c80f5e to your computer and use it in GitHub Desktop.
with markets as (
select * from iaac_cac where bcn3 = 'MERCATS')
,
nonmarkets as (
select * from iaac_cac where bcn3 != 'MERCATS'
)
select
row_number() over() as cartodb_id,
count(*),
markets.the_geom_webmercator as the_geom_webmercator
from markets, nonmarkets where
st_intersects(st_buffer(markets.the_geom_webmercator, 100) ,nonmarkets.the_geom_webmercator)
group by markets.the_geom_webmercator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment