#138 WIP NETGIS Map client
* adds functionality for address search widget * drops default proxy.php (replaced by own python call) * reduces maxZoom in config.json
This commit is contained in:
parent
d9ec0226fe
commit
eeccba3968
@ -24,7 +24,7 @@ from konova.autocompletes import EcoAccountAutocomplete, \
|
||||
ShareTeamAutocomplete, HandlerCodeAutocomplete
|
||||
from konova.settings import SSO_SERVER, SSO_PUBLIC_KEY, SSO_PRIVATE_KEY, DEBUG
|
||||
from konova.sso.sso import KonovaSSOClient
|
||||
from konova.views import logout_view, home_view, get_geom_parcels
|
||||
from konova.views import logout_view, home_view, get_geom_parcels, map_client_proxy_view
|
||||
|
||||
sso_client = KonovaSSOClient(SSO_SERVER, SSO_PUBLIC_KEY, SSO_PRIVATE_KEY)
|
||||
urlpatterns = [
|
||||
@ -41,6 +41,7 @@ urlpatterns = [
|
||||
path('analysis/', include("analysis.urls")),
|
||||
path('api/', include("api.urls")),
|
||||
path('geom/<id>/parcels', get_geom_parcels, name="geometry-parcels"),
|
||||
path('client/proxy', map_client_proxy_view, name="map-client-proxy"),
|
||||
|
||||
# Autocomplete paths for all apps
|
||||
path("atcmplt/eco-accounts", EcoAccountAutocomplete.as_view(), name="accounts-autocomplete"),
|
||||
|
@ -5,9 +5,12 @@ Contact: michel.peltriaux@sgdnord.rlp.de
|
||||
Created on: 16.11.20
|
||||
|
||||
"""
|
||||
import json
|
||||
|
||||
import requests
|
||||
from django.contrib.auth import logout
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
from django.http import HttpRequest, HttpResponse, JsonResponse
|
||||
from django.shortcuts import redirect, render, get_object_or_404
|
||||
from django.template.loader import render_to_string
|
||||
from django.utils import timezone
|
||||
@ -168,3 +171,26 @@ def get_500_view(request: HttpRequest):
|
||||
"""
|
||||
context = BaseContext.context
|
||||
return render(request, "500.html", context, status=500)
|
||||
|
||||
|
||||
@login_required
|
||||
def map_client_proxy_view(request: HttpRequest):
|
||||
""" Provides proxy functionality for NETGIS map client.
|
||||
|
||||
Used for fetching content of a provided url
|
||||
|
||||
Args:
|
||||
request (HttpRequest): The incoming request
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
url = request.META.get("QUERY_STRING")
|
||||
response = requests.get(url)
|
||||
body = json.loads(response.content)
|
||||
if response.status_code != 200:
|
||||
return JsonResponse({
|
||||
"status_code": response.status_code,
|
||||
"content": body,
|
||||
})
|
||||
return JsonResponse(body)
|
||||
|
@ -34,7 +34,7 @@
|
||||
"projection": "EPSG:25832",
|
||||
"center": [ 385000, 5543000 ],
|
||||
"minZoom": 5,
|
||||
"maxZoom": 25,
|
||||
"maxZoom": 21,
|
||||
"zoom": 8,
|
||||
"attribution": "LANIS RLP"
|
||||
},
|
||||
@ -46,6 +46,6 @@
|
||||
|
||||
"search":
|
||||
{
|
||||
"url": "./proxy.php?https://www.geoportal.rlp.de/mapbender/geoportal/gaz_geom_mobile.php?outputFormat=json&resultTarget=web&searchEPSG={epsg}&maxResults=5&maxRows=5&featureClass=P&style=full&searchText={q}&name_startsWith={q}"
|
||||
"url": "/client/proxy?https://www.geoportal.rlp.de/mapbender/geoportal/gaz_geom_mobile.php?outputFormat=json&resultTarget=web&searchEPSG={epsg}&maxResults=5&maxRows=5&featureClass=P&style=full&searchText={q}&name_startsWith={q}"
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
//$query = urldecode( $_GET[ "q" ] );
|
||||
$query = urldecode( $_SERVER[ "QUERY_STRING" ] );
|
||||
|
||||
// Open the Curl session
|
||||
$session = curl_init( $query );
|
||||
|
||||
// Don't return HTTP headers. Do return the contents of the call
|
||||
curl_setopt( $session, CURLOPT_HEADER, false );
|
||||
curl_setopt( $session, CURLOPT_RETURNTRANSFER, true );
|
||||
|
||||
// Make the call
|
||||
$response = curl_exec( $session );
|
||||
|
||||
// Output
|
||||
header( "Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept" );
|
||||
header( "Access-Control-Allow-Origin: *" );
|
||||
header( "Content-Type: application/json" );
|
||||
echo $response;
|
||||
|
||||
curl_close( $session );
|
Loading…
Reference in New Issue
Block a user