update for location extent
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
from sys import prefix
|
||||
from rest_framework import urlpatterns
|
||||
from rest_framework.routers import DefaultRouter
|
||||
from .views import LocationViewSet, Location_lineViewSet, Location_polygonViewSet, Jpn_Main_PerfViewSet, Jpn_PerfViewSet, LocationsInPerf, SubInPerf, ExtentForSubPerf, SubPerfInMainPerf, ExtentForMainPerf, LocationsInSubPerf, CatView, RegistrationAPI, LoginAPI, UserAPI, UserActionViewset, UserMakeActionViewset, UserDestinations, UpdateOrder, LocationInBound, DeleteDestination, CustomAreaLocations, GetAllGifuAreas, CustomAreaNames, userDetials, UserTracksViewSet, CatByCity, ChangePasswordView, GoalImageViewSet, CheckinImageViewSet
|
||||
from .views import LocationViewSet, Location_lineViewSet, Location_polygonViewSet, Jpn_Main_PerfViewSet, Jpn_PerfViewSet, LocationsInPerf, SubInPerf, ExtentForSubPerf, SubPerfInMainPerf, ExtentForMainPerf, LocationsInSubPerf, CatView, RegistrationAPI, LoginAPI, UserAPI, UserActionViewset, UserMakeActionViewset, UserDestinations, UpdateOrder, LocationInBound, DeleteDestination, CustomAreaLocations, GetAllGifuAreas, CustomAreaNames, userDetials, UserTracksViewSet, CatByCity, ChangePasswordView, GoalImageViewSet, CheckinImageViewSet, ExtentForLocations
|
||||
from django.urls import path, include
|
||||
from knox import views as knox_views
|
||||
|
||||
@ -30,6 +30,7 @@ urlpatterns += [
|
||||
path('subperfinmain/', SubPerfInMainPerf, name="sub_perf"),
|
||||
path('allgifuareas/', GetAllGifuAreas, name="gifu_area"),
|
||||
path('perfext/', ExtentForSubPerf, name="sub_perf_ext"),
|
||||
path('locsext/', ExtentForLocations, name="locs_ext"),
|
||||
path('mainperfext/', ExtentForMainPerf, name="main_perf_ext"),
|
||||
path('cats/', CatView, name='cats'),
|
||||
path('catbycity/', CatByCity, name='cat_by_city'),
|
||||
|
||||
@ -12,6 +12,7 @@ from rest_framework.parsers import JSONParser, MultiPartParser
|
||||
from .serializers import LocationSerializer
|
||||
from django.http import JsonResponse
|
||||
from rest_framework.permissions import IsAuthenticated
|
||||
from django.contrib.gis.db.models import Extent, Union
|
||||
|
||||
from .serializers import TestSerialiser
|
||||
from .models import TestModel
|
||||
@ -204,6 +205,12 @@ def ExtentForMainPerf(request):
|
||||
# iata = serializers.serialize("json",ext)
|
||||
return JsonResponse(ext, safe=False)
|
||||
|
||||
|
||||
def ExtentForLocations(request):
|
||||
locs = Location.objects.aggregate(Extent('geom'), Union('geom'))
|
||||
return JsonResponse(locs['geom__extent'], safe=False)
|
||||
|
||||
|
||||
def ExtentForSubPerf(request):
|
||||
sub_perf_id = request.GET.get('sub_perf')
|
||||
sub_perf = JpnSubPerf.objects.get(id=sub_perf_id)
|
||||
|
||||
Reference in New Issue
Block a user