Esempio n. 1
0
        'observation_well_status':
        get_model_feature_schema(Well, 'observation_well_status')
    })


@swagger_auto_schema(operation_description=(
    'Get GeoJSON (see https://tools.ietf.org/html/rfc7946) dump of wells.'),
                     method='get',
                     manual_parameters=GEO_JSON_PARAMS,
                     responses={
                         302:
                         openapi.Response(GEO_JSON_302_MESSAGE),
                         200:
                         openapi.Response(
                             'GeoJSON data for well.',
                             get_geojson_schema(WELL_PROPERTIES, 'Point'))
                     })
@api_view(['GET'])
def well_geojson(request, **kwargs):
    realtime = request.GET.get('realtime') in ('True', 'true')
    if realtime:
        sw_long = request.query_params.get('sw_long')
        sw_lat = request.query_params.get('sw_lat')
        ne_long = request.query_params.get('ne_long')
        ne_lat = request.query_params.get('ne_lat')
        bounds = None
        bounds_sql = ''

        if sw_long and sw_lat and ne_long and ne_lat:
            bounds_sql = 'and geom @ ST_MakeEnvelope(%s, %s, %s, %s, 4326)'
            bounds = (sw_long, sw_lat, ne_long, ne_lat)
Esempio n. 2
0
        'notes':
        get_model_feature_schema(Aquifer, 'notes')
    })


@swagger_auto_schema(operation_description=(
    'Get GeoJSON (see https://tools.ietf.org/html/rfc7946) dump of aquifers.'),
                     method='get',
                     manual_parameters=GEO_JSON_PARAMS,
                     responses={
                         302:
                         openapi.Response(GEO_JSON_302_MESSAGE),
                         200:
                         openapi.Response(
                             'GeoJSON data for aquifers.',
                             get_geojson_schema(AQUIFER_PROPERTIES, 'Polygon'))
                     })
@api_view(['GET'])
def aquifer_geojson(request, **kwargs):
    realtime = request.GET.get('realtime') in ('True', 'true')
    if realtime:

        sw_long = request.query_params.get('sw_long')
        sw_lat = request.query_params.get('sw_lat')
        ne_long = request.query_params.get('ne_long')
        ne_lat = request.query_params.get('ne_lat')

        if sw_long and sw_lat and ne_long and ne_lat:
            bounds_sql = 'and geom @ ST_Transform(ST_MakeEnvelope(%s, %s, %s, %s, 4326), 3005)'
            bounds = (sw_long, sw_lat, ne_long, ne_lat)
        else: