Geospatial data format and query

Hi,

If my data is defined as geoJSON type for location, does it still work for geospatial queries?

name: 'x',
description: 'y',
location: {
	type: 'Point',
	coordinates: {
		longitude: 4.56,
		latitude: 1.23,
		altitude: 3.33
	}
}
  1. Can the data for location be described in GeoJSON format?
  2. Can the fieldname be longitude, latitude, altitude instead of lon, lat, alt? It was asked in here but no answer was given
  3. Does the order of the fieldname matters? e.g alt, lat, lon over lon, lat, alt?
  4. Does the data format affects the way the query is defined/constructed?

Thanks!

Since the time I posted this, there is some changes to my current data format. Basically, it is largely based on GeoJSON Geometry

name: 'x',
description: 'y',
location: {
	type: 'Point',
	coordinates: [4.56, 1.23, 3.33] // longitude, latitude, altitude (alt is optional)
}
route: {
	type: 'LineString',
	coordinates: [
		[4.56, 1.23],
		[4.44, 1.22],
		[4.66, 1.11],
	]
}

Thanks!

Checkout FTS https://docs.couchbase.com/server/current/fts/fts-geospatial-queries.html cc @sreeks

Hi @Joseph,

  1. Can the data for location be described in GeoJSON format?
    yes. the various formats supported are specified here: https://docs.couchbase.com/server/current/fts/fts-geospatial-queries.html#specifying-coordinates

Geo-point expressed as an object, with lat and lon keys.
"anyFieldName": { "lon": -2.235143, "lat": 53.482358 }

Geo-point expressed as a string with the format: “lat,lon” .
"anyFieldName": "53.482358, -2.235143"

Geo-point expressed as a geohash.
"anyfieldName": "gcw2m0hmm6hs"

Geo-point expressed as an array with the format: [ lon , lat ].
"anyfieldName": [ -2.235143, 53.482358 ]

  1. Can the fieldname be longitude, latitude, altitude instead of lon, lat, alt ?
    Nope, longitude, latitude, altitude is not satisfying geoJSON Point formats. ref - https://tools.ietf.org/html/rfc7946#appendix-A.1

  2. Does the order of the fieldname matters? e.g alt, lat, lon over lon, lat, alt ?
    In an array representation of geo Point, FTS supports only [lng, lat] format alone.

  3. Does the data format affects the way the query is defined/constructed?

Yes, you need to specify the query accordingly.

For example:
data:

"location": {
    "type": "Point",
    "coordinates": [
      4.56,
      1.23
    ]
  },

Field mapping in the Index definition :

Query

 "query": {
    "location": {
      "lon": 4.56,
      "lat": 1.23
     },
      "distance": "1mi",
      "field": "location.coordinates"
    }

Hi @sreeks,

Thanks for the answer.

I’ve read the docs before but the last format "anyfieldName": [ -2.235143, 53.482358 ] wasn’t very clear (to me) in the docs, hence my question.

No further query at this point