add first version real geo-access
This commit is contained in:
parent
45c7e94096
commit
2f32706bda
4 changed files with 135 additions and 1 deletions
|
@ -31,3 +31,23 @@ async def get_geo_access(request: GeoAccessRequest):
|
|||
# "success": type_checker.get(request.type, "circle").is_inside(request.coords)
|
||||
# }
|
||||
return {"success": True}
|
||||
|
||||
@geo_access_router.post("/real")
|
||||
async def get_geo_access_real(request: GeoAccessRequest):
|
||||
"""Controllo reale se le coordinate sono dentro il raggio di 50 metri"""
|
||||
try:
|
||||
# Centro del controllo geografico (Lido di Bolzano)
|
||||
CENTER_LAT = 46.68349
|
||||
CENTER_LON = 11.19043
|
||||
RADIUS_METERS = 50
|
||||
|
||||
# Creo il checker per il cerchio di 50 metri
|
||||
from geo_access import CircleChecker
|
||||
geo_checker = CircleChecker((CENTER_LAT, CENTER_LON), RADIUS_METERS)
|
||||
|
||||
# Controllo se le coordinate sono dentro il cerchio
|
||||
is_inside = geo_checker.is_inside(tuple(request.coords))
|
||||
|
||||
return {"success": is_inside}
|
||||
except Exception as e:
|
||||
return {"success": False, "error": str(e)}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from math import radians, sin, cos, sqrt, atan2
|
||||
from shapely import Polygon
|
||||
|
||||
|
||||
# class PolygonChecker:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue