Source: factory.core/ObjGeoZone.py
Define, persist, and query geographic zones.
Usage:
zone = ObjGeoZone()
zone.define_circle(-33.9249, 18.4241, radius_km=10)
...
| Method | Signature | Description |
|---|---|---|
| define_circle | define_circle(center_lat: float, center_lng: float, radius_km: float) -> None |
Define the zone as a circle around a center point. |
| define_polygon | define_polygon(points: List[GeoCoordType]) -> None |
Define the zone as an arbitrary polygon. |
| define_bbox | define_bbox(min_lat: float, min_lng: float, max_lat: float, max_lng: float) -> None |
Define the zone as an axis-aligned bounding box. |
| contains | contains(lat: float, lng: float) -> bool |
Return True if the coordinate (lat, lng) lies within this zone. |
| distance_to_center | distance_to_center(lat: float, lng: float) -> Optional[float] |
Return the Haversine distance (km) from (lat, lng) to the zone |
| save | save(zone_code: str, zone_name: str, package: str = '') -> bool |
Persist the zone definition to the database. |
| load | load(zone_code: str, package: str = '') -> bool |
Load a zone definition from the database. |