Ejemplo n.º 1
0
 def save_placemark(self):
     es.index(index=CONFIG.ES_INDEX,
              doc_type='item',
              body=json.dumps({
                  'open_data': self.open_data,
                  'shape': self.geometry,
                  'mbr_data': self.mbr_data,
                  'center': self.center,
                  'type': self.type
              }))
Ejemplo n.º 2
0
def item_create():
    # Check ACL
    if not func.acl_approval():
        return func.error(CONST.STRINGS['ACCESS_DENIED'])

    # Get data from POST
    data = request.json

    # Create new object
    es.index(index=CONFIG.ES_INDEX,
         doc_type='item',
         body=json.dumps({
             'open_data': data['open_data'],
             'shape': data['shape'],
             'mbr_data': func.calculate_mbr(data['shape']),
             'center': func.calculate_center(data['shape']),
             'type': 'point' if data['shape'].__len__() <= 2 else 'polygon'
         }))