django - Data structure: mongoengine to GeoJson -


i posted first question on stackoverflow, think question quite extensive , full of potential errors. i'd begin again, step-by-step, shorter , simplier question :

do think code correct ?

the purpose structure models.py store datas in mongo database geojson objects.

thanks lot !


models.py :

# -*- coding: utf-8 -*-  mongoengine import * connect(‘mongodb_jsons’)  import datetime  class geojson(document):  # geojson object  # save in mongodb geojson structure      date_created = datetimefield(default=datetime.datetime.now)     location = pointfield(auto_index=false) # list of 2 float numbers [ 10.000 , 240.000 ]     content1 = charfield()     content2 = charfield()      meta = {'db_alias': 'mongodb_jsons', # save in db ‘mongodb_jsons’             'indexes': [                 # geojson structure                 {'type' : 'feature', {                    'geometry':{                         'type' : 'point',                         'coordinates' : ('location', '2dsphere')                         },                     'properties':{                        'content1' : 'content1',                        'content2' : 'content2',                            'date_creation' : 'date_created'                         }                     }                 }]             } 

that won't work - need 2dsphere index geojson in mongodb. why not use pointfield described in mongoengine documentation.


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -