Skip to content

Instantly share code, notes, and snippets.

@AbelVM
Created August 19, 2016 14:08
Show Gist options
  • Save AbelVM/05b21cb82e805a57f0b014fcd49f7f35 to your computer and use it in GitHub Desktop.
Save AbelVM/05b21cb82e805a57f0b014fcd49f7f35 to your computer and use it in GitHub Desktop.
WITH
input_query as(
SELECT
*
FROM airports
order by cartodb_id asc
limit 1000
),
moran as(
SELECT
*
FROM cdb_crankshaft.CDB_AreasOfInterestLocal(
'SELECT * FROM airports order by cartodb_id asc limit 1000',
'elevation_ft',
'knn',
5,
99,
'the_geom',
'cartodb_id')
)
SELECT input_query.*, moran.*
FROM
input_query,
moran
WHERE moran.rowid = input_query.cartodb_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment