add commandline options
This commit is contained in:
parent
8918593615
commit
dd42a02796
1 changed files with 16 additions and 3 deletions
19
mapbender.py
Normal file → Executable file
19
mapbender.py
Normal file → Executable file
|
@ -1,6 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import sys
|
|
||||||
import math
|
import math
|
||||||
from math import sqrt
|
from math import sqrt
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@ -319,6 +318,18 @@ def main(x,y,width,smoothing,subdiv):
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
x = []
|
x = []
|
||||||
y = []
|
y = []
|
||||||
|
import sys
|
||||||
|
if len(sys.argv) != 5:
|
||||||
|
print "usage: %s data.csv width smoothing N"%sys.argv[0]
|
||||||
|
print ""
|
||||||
|
print " data.csv whitespace delimited lon/lat pairs of points along the path"
|
||||||
|
print " width width of the resulting map in degrees"
|
||||||
|
print " smoothing curve smoothing from 0 (exact fit) to higher values (looser fit)"
|
||||||
|
print " N amount of quads to split the path into"
|
||||||
|
print ""
|
||||||
|
print " example usage:"
|
||||||
|
print " %s Weser-Radweg-Hauptroute.csv 0.286 6 20"%sys.argv[0]
|
||||||
|
exit(1)
|
||||||
with open(sys.argv[1]) as f:
|
with open(sys.argv[1]) as f:
|
||||||
for l in f:
|
for l in f:
|
||||||
a,b = l.split()
|
a,b = l.split()
|
||||||
|
@ -326,8 +337,10 @@ if __name__ == '__main__':
|
||||||
b = lat2y(float(b))
|
b = lat2y(float(b))
|
||||||
x.append(float(a))
|
x.append(float(a))
|
||||||
y.append(b)
|
y.append(b)
|
||||||
width = 2.0/7.0
|
width = float(sys.argv[2])
|
||||||
main(x,y,width,6,20)
|
smoothing = float(sys.argv[3])
|
||||||
|
N = int(sys.argv[4])
|
||||||
|
main(x,y,width,smoothing,N)
|
||||||
#for smoothing in [1,2,4,8,12]:
|
#for smoothing in [1,2,4,8,12]:
|
||||||
# for subdiv in range(10,30):
|
# for subdiv in range(10,30):
|
||||||
# if main(x,y,width,smoothing,subdiv):
|
# if main(x,y,width,smoothing,subdiv):
|
||||||
|
|
Loading…
Reference in a new issue