I’ve created geospatial index on my collection using the statement with PyMongo :
self.geo_collection.create_index([('location',pymongo.GEO2D)],\
min=0,max=700,name='test_name')
but when I try to execute the following query :
{'_id': ObjectId('4fa739422d38036937000000'), 'location': {'$within': {'$polygon': [[165, 10], [165, 90], [290, 10], [290, 90]]}}}
I always get a
database error: point not in interval of [ -180, 180 )
Can anybody help me figure out what’s going on? Thanks.
Geospatial indexing works as advertised. To use $polygon you will have to have mongodb version 1.9 or greater. I ran the following script on mongodb 2.0.4 without any problems
with the following result