update
This commit is contained in:
@ -81,7 +81,7 @@ def LocationInBound(request):
|
||||
lat4 = float(request.GET.get('la4'))
|
||||
lon4 = float(request.GET.get('ln4'))
|
||||
cat = request.GET.get('cat')
|
||||
|
||||
|
||||
|
||||
if(lat1 != None and lon1 != None and lat2 != None and lon2 != None and lat3 != None and lon3 != None and lat4 != None and lon4 != None):
|
||||
pl = geos.Polygon(((lon1, lat1), (lon2, lat2), (lon3, lat3), (lon4, lat4), (lon1, lat1)), srid=4326)
|
||||
@ -90,6 +90,8 @@ def LocationInBound(request):
|
||||
else:
|
||||
locs = Location.objects.filter(geom__within=pl)
|
||||
res = Location.objects.filter(geom__within=pl)
|
||||
if len(res) > 50:
|
||||
return JsonResponse({"too_many_points": True}, safe=False, status=500)
|
||||
serializer = LocationSerializer(res, many=True)
|
||||
return JsonResponse(serializer.data, safe=False)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user