# -*- coding: utf-8 -*- from openelevationservice import SETTINGS from openelevationservice.server.utils.logger import get_logger from openelevationservice.server.db_import.models import db, Cgiar from openelevationservice.server.utils.custom_func import ST_SnapToGrid from openelevationservice.server.api.api_exceptions import InvalidUsage from geoalchemy2.functions import ST_DumpPoints, ST_Dump, ST_Value, ST_Intersects, ST_X, ST_Y from sqlalchemy import func import json log = get_logger(__name__) coord_precision = SETTINGS['coord_precision'] def _getModel(dataset): """ Choose model based on dataset parameter :param dataset: elevation dataset to use for querying :type dataset: string :returns: database model :rtype: SQLAlchemy model """ if dataset == 'srtm': model = Cgiar return model
# -*- coding: utf-8 -*- from openelevationservice.server.api import api_exceptions from openelevationservice.server.utils import logger from cerberus import Validator, TypeDefinition log = logger.get_logger(__name__) object_type = TypeDefinition("object", (object, ), ()) Validator.types_mapping['object'] = object_type v = Validator() schema_post = { 'geometry': { 'anyof_type': ['object', 'list', 'string'], 'required': True }, 'format_in': { 'type': 'string', 'allowed': ['geojson', 'point', 'encodedpolyline', 'polyline'], 'required': True }, 'format_out': { 'type': 'string', 'allowed': ['geojson', 'point', 'encodedpolyline', 'polyline'], 'default': 'geojson' }, 'dataset': { 'type': 'string', 'allowed': ['srtm'],