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
MongoDB query using $near not working when nested
I have several documents in my Articles collection. Every document has a location value and some extra data. The location value looks like this:
"loc" : {
"type" : "Point",
"coordinates" : [
4,
54
]
}
I can build an…

Thomas Bormans
- 5,156
- 6
- 34
- 51
0
votes
1 answer
Improve geoIndex performance on mongo
I have the next collection sample:
var testSchema = new Schema({
title: {type: String, required: true},
owner: {type:Schema.Types.ObjectId},
locatedAt: {type: {}, index: '2dsphere', sparse: true, "2dsphereIndexVersion": 2,…

Iván Peralta
- 851
- 1
- 9
- 25
0
votes
0 answers
Near in php - mongodb spatial index and query
I am using php to query nearby places.
I have the following geoJSON in mongoDB
{
"_id": {
"$oid": "dsfsdfsdfsdfsdfsdfsdf"
},
"type": "Feature",
"geometry": {
…

user3691240
- 45
- 2
- 7
0
votes
1 answer
Index prefix doesn't work if a compound index contains 2dsphere index
> db.test.ensureIndex({x: 1, location: '2dsphere'})
{
"createdCollectionAutomatically" : false,
"numIndexesBefore" : 1,
"numIndexesAfter" : 2,
"ok" : 1
}
> db.test.find({x: 0}).explain()
{
"cursor" :…

user805627
- 4,247
- 6
- 32
- 43
0
votes
0 answers
fastest way to query mongoDB for 3000 GeoJSON with multipolygons
I have the following :
openshift cardridges with Node.js 0.10 and MongoDB 2.4
5000 GeoJSON files, each containing a single multipolygon
I am trying to build an app where the user would submit the coordinates of a point and get a list of all the…

Franckl
- 1,401
- 2
- 12
- 17
0
votes
1 answer
2dsphere index query returns all documents
I'm using MongoDB 2.6.1 on Mac OS X
I have a collection of locations with a valid GeoJSON field:
db.locations.findOne({}, {"location": 1})
{
1"_id" : ObjectId("534fd2b6b13e51768cd0e9c8"),
"location" : {
"type" : "Point",
"coordinates" : [
…

zjor
- 994
- 2
- 12
- 22
0
votes
1 answer
why i make a 2dsphere index ,but when i query it shows s2cursor?
why i make a 2dsphere index ,but when i query it shows s2cursor, i think it should be geosearchcursor. the mongodb document says this:
http://docs.mongodb.org/manual/reference/method/cursor.explain/#explain-output-fields-core
cursor is a string…

gnemoug
- 467
- 1
- 5
- 21
-1
votes
1 answer
Draw sphere OpenGL C++
I am trying to draw a Sphere using OpenGL and C++, but I can't use the glut Sphere function. I am passing the coordinates (x, y, z), the color white (1.0f, 1.0f, 1.0f) and saving sequentially in the vertex array (vertices).
/** Vertex shader.…

Rafael Greca
- 13
- 2
-1
votes
2 answers
Mongodb find near users point with distance
we have a problem for find near users point with distance in mongodb database. the our main problem is we can't aggregate near point with distance. we used $geoWithin with below query:
db.users.find({ location: { $geoWithin:
{…

Ehsan Farahani Asil
- 63
- 1
- 2
- 10