-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
27 lines (22 loc) · 829 Bytes
/
main.py
File metadata and controls
27 lines (22 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from dem import DEM
from parcel import Parcel
from logger import log
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-x", "--lon", type=float, help="Współrzędne działki w osi x")
parser.add_argument("-y", "--lat", type=float, help="Współrzędne działki w osi y")
parser.add_argument("-t", "--teryt", type=str, help="Pełny adres działki")
parser.add_argument("-f", "--format", type=str, help="Format danych wyjściowych: [text, json]", default="text")
args = parser.parse_args()
if args.lon and args.lat:
parcel = Parcel(x=args.lon, y=args.lat)
elif args.teryt:
parcel = Parcel(addr=args.teryt)
else:
log.error("Musisz podać współrzędne lub adres działki")
parcel = None
exit(1)
if args.format == "text":
print(parcel.text_repr)
else:
print(parcel.json_repr)