Has anyone used geospatial searching with mongengine? I can't seem to get it to work! What is the format of the data that has to go in the GeoPointField?
How should i format it? I can't find anything about the formating in the documentation!
Geospatial queries are specialized types of SQL queries supported in Athena. They differ from non-spatial SQL queries in the following ways: Using the following specialized geometry data types: point , line , multiline , polygon , and multipolygon .
In MongoDB, you can store geospatial data as GeoJSON objects or as legacy coordinate pairs.
MongoDB is a NoSQL database that is rapidly gaining popularity. All data is stored in JSON which works awesome on Node. js. MongoDB is capable of geospatial queries when set up properly.
MongoDB, which is a NoSQL Database, allows storing of Geospatial Data in the form of multiple GeoJSON types. Geospatial Feature of MongoDB makes it easy to store Geographical data into a database. So, basically, you can store the geospatial type data in the MongoDB in the form of GeoJSON objects.
Can you post what you are trying to do??
Point data must be stored in a field with key
"loc":{"lon":51.10682735591432, "lat":-114.11773681640625}
or
loc: [22.23432, 21.23212]
With mongoengine there is support for a geopoint field
Class Location:
point = GeoPointField()
new_location = Location(point=[21.1232,23.23432])
new_location.save()
something like above should work.
class GeoPointField(db_field=None, name=None, required=False, default=None, unique=False, unique_with=None, primary_key=False, validation=None, choices=None, verbose_name=None, help_text=None):
A list storing a latitude and longitude.
New in version 0.4.
http://mongoengine-odm.readthedocs.org/en/latest/apireference.html#mongoengine.GeoPointField
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With