Search code examples
couchbasegeojson

Couchbase and GeoSpatial data


Can't find documentation/howtos/examples for using Geo Views in couchbase.

Simplified task: my document looks like:

{
 x:10,
 y:15,
 color:"RED"
}

and I need to find all BLUE points in square

{top:1,left:1,right:34,bottom:77}

Solution

  • There's an example of how to perform a geospatial view in the Couchbase Java SDK Developer Guide.

    The main things to be aware of:

    • Your emitted documents (i.e. map() function result) needs to conform to the GeoJSON specification.
    • (In the Java SDK at least) you need to use the getSpatialView() method to query it.