You can indeed use dashDB for that.
It provides all the OGC standard conform SQL extensions. For your case you would take ST_Buffer
function to define a circle geometry around a given point (use ST_GeomFromText
to construct the geometry point from a given longitude and latitude). Then you would use ST_Within
to find all rows where the geometry (I assume you just have points for now) is within the circle.
Something like the following predicate should work for you:
WHERE DB2GSE.ST_WITHIN( your_points_column, DB2GSE.ST_Buffer(
DB2GSE.ST_GeomFromText( 'POINT (<long float value>, <lat float value>)', 1005),
5000, 'METRE') = 1
Here is an example that should work with the dashDB sample data right away:
with target as (select db2gse.st_buffer(db2gse.st_geomfromtext('POINT
(-80.6233232399 40.0725289742)',1005),10000,'METRE') as buffer
from SYSIBM.SYSDUMMY1) SELECT count(*) FROM SAMPLES.GEO_CUSTOMER C,
TARGET T WHERE DB2GSE.ST_WITHIN(C.SHAPE,T.BUFFER) = 1
Relevant documentation links for:
In response to a comment above is about Cloudant, here is one more goody: you can set up a dashDB warehouse for any given Cloudant db very easily in the Cloudant.com portal. The schema is discovered automatically and initial load as well as ongoing ETL is also automatically done.