0

I have a set of data in a table which contains latitude and longitude as well. I need to query these data which has Lat,Long within 5 km in radius.

I have tried using IBM bluemix with BigSQL and DashDB. Please sugguest a possible solution.

Note: I can't use any RDBMS databases like MySQL/PostGre. Constrained to use BigData.

Viswanath Lekshmanan
  • 9,945
  • 1
  • 40
  • 64

3 Answers3

2

You should use the Cloudant DBaaS service. It is built on top of CouchDB and is particularly good at handling geospatial data. Check out the following site for more info: https://cloudant.com/product/cloudant-features/geospatial/

Jake Peyser
  • 1,180
  • 8
  • 17
0

dashDB is the best solution in Bluemix for analysing spatial data. It have predefined spatial functions too.

You said you have tried dashDB. Did you face any problems ? Please let me know and i can help you in that.

Thanks,

0

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.

A.L
  • 10,259
  • 10
  • 67
  • 98