Index that supports queries that calculate geometries on an earth-like sphere. It supports data stored as both GeoJSON objects and as legacy coordinate pairs.
Questions tagged [2dsphere]
69 questions
0
votes
0 answers
Planner returned error: unable to find index for $geoNear query
I am using $nearSphere operator in my query and passing the latitude and longitude but it returns
error- unable to find the index for $geoNear query.
I found a couple of solutions and I have used in the schema:
scheduleRideSchema.index({…

Siddhartha Singh
- 11
- 3
0
votes
0 answers
nodejs - Mongoose 5.3.8 - GeoJSON queries not working
I am attempting to store and query locations based on coordinate points with Mongoose 5.3.8 in order to return points within the radius of another point.
I have read the docs and have implemented the pointSchema + citySchema example in the…

Bdyce
- 332
- 2
- 11
0
votes
1 answer
How do I calculate the total distance traveled with MongoDB
I need to calculate the total distance traveled between a collection of points. They all have a timestamp to get them in the right order. I'm only allowed to use MongoDB.
Sample collection:
{
"_id" : ObjectId("596cd354241aa3174056fb98"),
…

Brent
- 21
- 1
- 6
0
votes
1 answer
Determine Route Between MongoDB 2dsphere points
I have an algorithm that currently pulls a few 2Dsphere points (no more than 6) from my database, which are all within a certain radius from one another. Once I have pulled these points, I want to order them in an efficient route and return them in…

user3802348
- 2,502
- 11
- 36
- 49
0
votes
0 answers
Mongoose/MongoDB Geo spatial indexing not working
First time using MongoDD. I have been combing the internet for hours trying to figure out what I am doing wrong. MongoDB is telling me that there is no index present after executing a geo query.
I have included the error. Any ideas?
The Schema
var…

jjhenry
- 515
- 2
- 5
- 8
0
votes
1 answer
mongodb $geoIntersects or $geoWithin a point matches multiple polygons - sort by area?
I have a mongo query that checks to see if a point is within a polygon.
neighborhood = db.collection.findOne({
loc: {$geoInteresects: {$geometry: {
type: 'Point',
coordinates: [lng, lat]
}}}
})
Currently, all of my polygons…

Paul T.
- 329
- 3
- 15
0
votes
1 answer
2dsphere index of mongodb fails on this polygon
having already lots of polygons in my collection, but on this one the creation is not possible.. anybody have an idea why?
http://geojsonlint.com/ says this polygon is okay... :(
{ "type": "Feature", "properties": { "name": "Mistelbach" },
…

Harald Wiesinger
- 651
- 3
- 11
- 23
0
votes
0 answers
Mean stack 2dsphere radius search
I am new to mean stack (and programming in general) but have a simple app up and running.
My model looks like this:
var mongoose = require('bluebird').promisifyAll(require('mongoose'));
var RestaurantSchema = new mongoose.Schema({
name: String,
…

Kasper K
- 89
- 5
0
votes
1 answer
MongoDB geospatial query does not return anything
I have a collection with a 2dsphere index and want to use the $geoWithin and $centerSphere functions to query it.
Excerpt of the model:
{
// ...
coordinates: {
coordinates: {
type: Array,
index: '2dsphere'
}
}
// ...
}
I…

Haensl
- 343
- 3
- 16
0
votes
0 answers
Reverse latitude and longitude in mongodb 2Dsphere indexes
Actually, mongodb stores coordinates ordered by [, ].
As I use directly db models in my angular app, and all services like google maps or openstreetmap uses the maritime format (reversed order), it would be really more easy to…

G33k Labs
- 340
- 1
- 2
- 9
0
votes
0 answers
store 2dsphere locations in embedded document and query the locations field
I am trying this model schema and i am not sure if i will be able to query the locations field this way.
var garageSchema = new Schema({
user_id :{ type: Schema.Types.ObjectId, ref: "User" },
locations :[{…

Crimeira
- 149
- 10
0
votes
1 answer
Node.js and Mongoose return 2D query
I have a simple problem, I am trying to return a MongoDB document after a query in my Node.js server :
var coords = [];
coords[0] = req.query.valArray.lng; // client latitude
coords[1] = req.query.valArray.lat; // client longitude
…

Itsik Mauyhas
- 3,824
- 14
- 69
- 114
0
votes
1 answer
geoNear in MongoDB returns empty result
In MongoDB I have created a database named 'GIS' and a collection named 'UTILITIES'. I have inserted some GeoJSON elements as below
{
"_id" : ObjectId("54e6de457e550c23bc1521a0"),
"id" : "1",
"geometry" : {
"coordinates" : [
86.74957,…

Chandan Kumar Rath
- 147
- 1
- 14
0
votes
2 answers
MongoDB 2dsphere spatial index creation error
In MongoDB I have created a database named 'GIS' and a collection named 'UTILITIES' and within the collection I have inserted a BSON document as below.
{
"_id" : ObjectId("54e6b3ca7e550c1f4c2b47f6"),
"features" : [
{
"id" : "1",
…

Chandan Kumar Rath
- 147
- 1
- 14
0
votes
1 answer
YiiMongoDbSuite + 2dsphere not working
I have YiiMongoDbSuite 1.3.6
$users = MyModel::model()->findAll(array(
'conditions'=>array(
'loc'=>array(
'near' => array(50,50),
…

1nstinct
- 1,745
- 1
- 26
- 30