Compare commits

...

No commits in common. "master" and "data" have entirely different histories.
master ... data

10 changed files with 144 additions and 2474 deletions

2
.gitignore vendored
View File

@ -1,2 +0,0 @@
members.*

View File

@ -1,5 +0,0 @@
# VEB IT map
this GeoJSON generator simply produces markers for a map of members.
the resolution is set to a 11km grid for not identifying people easily.

View File

@ -1,23 +0,0 @@
#!/usr/bin/env sh
echo "this takes some time depending on the amount of addresses in your lists …"
for file in *.csv ; do
out=$(echo "${file}"|cut -d"." -f1)".geojson"
if test -e "${out}" ; then
echo "file exists: ${out}, skipping."
continue
fi
echo ./lookup.py "${file}"
./lookup.py "${file}" > "${out}"
#~ fs=$(stat -t "${out}" |cut -d" " -f2)
#~ data="vebit-geojson/"
#~ if test "$fs" -gt 0 ; then
#~ if test -d "$data" ; then
#~ cp -f "${out}" "$data"
#~ cd "$data"
#~ git commit "${out}" -m "update file" && git push
#~ fi
#~ fi
done

81
ct.geojson Normal file
View File

@ -0,0 +1,81 @@
{"type":"FeatureCollection","features":[
{"type":"Feature","geometry":{"type":"Point","coordinates":[10.07,48.84]},"properties":{"name":"Aalen","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[4.87,52.36]},"properties":{"name":"Amsterdam","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[9.14,49.99]},"properties":{"name":"Aschaffenburg","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[10.89,48.36]},"properties":{"name":"Augsburg","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[11.59,49.93]},"properties":{"name":"Bayreuth","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[7.45,46.96]},"properties":{"name":"Bern","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[8.53,52.04]},"properties":{"name":"Bielefeld","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[19.06,47.49]},"properties":{"name":"Budapest","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[10.95,50.27]},"properties":{"name":"Coburg","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[11.04,50.98]},"properties":{"name":"Erfurt","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[9.42,54.80]},"properties":{"name":"Flensburg","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[9.67,50.56]},"properties":{"name":"Fulda","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[8.68,50.58]},"properties":{"name":"Gießen","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[15.45,47.07]},"properties":{"name":"Graz","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[11.99,51.48]},"properties":{"name":"Halle a. d. Saale","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[9.95,52.17]},"properties":{"name":"Hildesheim","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[11.38,48.77]},"properties":{"name":"Ingolstadt","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[11.40,47.26]},"properties":{"name":"Innsbruck","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[9.50,53.94]},"properties":{"name":"Itzehoe","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[11.58,50.93]},"properties":{"name":"Jena","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[12.34,51.34]},"properties":{"name":"Leipzig","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[6.12,49.62]},"properties":{"name":"Luxemburg","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[10.67,53.87]},"properties":{"name":"Lübeck","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[9.40,47.71]},"properties":{"name":"Markdorf","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[7.64,51.94]},"properties":{"name":"Münster","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[6.69,51.19]},"properties":{"name":"Neuss","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[11.08,49.45]},"properties":{"name":"Nürnberg","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[7.94,48.47]},"properties":{"name":"Offenburg","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[13.08,52.39]},"properties":{"name":"Potsdam","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[7.17,51.62]},"properties":{"name":"Recklinghausen","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[12.12,49.01]},"properties":{"name":"Regensburg","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[10.18,49.38]},"properties":{"name":"Rothenburg ob der Tauber","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[4.43,51.91]},"properties":{"name":"Rotterdam","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[11.42,53.60]},"properties":{"name":"Schwerin","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[6.62,49.75]},"properties":{"name":"Trier","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[7.69,51.54]},"properties":{"name":"Unna","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[8.46,48.06]},"properties":{"name":"Villingen-Schwenningen","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[8.50,50.56]},"properties":{"name":"Wetzlar","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[8.73,47.50]},"properties":{"name":"Winterthur","marker":"ct"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[7.14,51.27]},"properties":{"name":"Wuppertal","marker":"ct"}}
]}

63
erfa.geojson Normal file
View File

@ -0,0 +1,63 @@
{"type":"FeatureCollection","features":[
{"type":"Feature","geometry":{"type":"Point","coordinates":[6.11,50.79]},"properties":{"name":"Aachen","marker":"erfa"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[10.89,49.90]},"properties":{"name":"Bamberg","marker":"erfa"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[7.63,47.53]},"properties":{"name":"Basel","marker":"erfa"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[13.38,52.52]},"properties":{"name":"Berlin","marker":"erfa"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[8.82,53.08]},"properties":{"name":"Bremen","marker":"erfa"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[8.65,49.87]},"properties":{"name":"Darmstadt","marker":"erfa"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[7.46,51.53]},"properties":{"name":"Dortmund","marker":"erfa"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[13.73,51.08]},"properties":{"name":"Dresden","marker":"erfa"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[6.78,51.22]},"properties":{"name":"Düsseldorf","marker":"erfa"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[11.00,49.60]},"properties":{"name":"Erlangen","marker":"erfa"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[7.02,51.44]},"properties":{"name":"Essen","marker":"erfa"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[8.64,50.12]},"properties":{"name":"Frankfurt am Main","marker":"erfa"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[7.84,47.99]},"properties":{"name":"Freiburg","marker":"erfa"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[9.95,51.55]},"properties":{"name":"Göttingen","marker":"erfa"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[9.94,53.56]},"properties":{"name":"Hamburg","marker":"erfa"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[9.72,52.39]},"properties":{"name":"Hannover","marker":"erfa"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[7.76,49.44]},"properties":{"name":"Kaiserslautern","marker":"erfa"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[8.41,49.01]},"properties":{"name":"Karlsruhe","marker":"erfa"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[9.48,51.32]},"properties":{"name":"Kassel","marker":"erfa"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[6.91,50.95]},"properties":{"name":"Köln","marker":"erfa"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[8.49,49.46]},"properties":{"name":"Mannheim","marker":"erfa"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[11.56,48.15]},"properties":{"name":"München","marker":"erfa"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[8.75,51.72]},"properties":{"name":"Paderborn","marker":"erfa"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[13.06,47.79]},"properties":{"name":"Salzburg","marker":"erfa"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[8.00,50.87]},"properties":{"name":"Siegen","marker":"erfa"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[9.18,48.78]},"properties":{"name":"Stuttgart","marker":"erfa"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[9.99,48.40]},"properties":{"name":"Ulm","marker":"erfa"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[16.36,48.21]},"properties":{"name":"Wien","marker":"erfa"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[8.23,50.08]},"properties":{"name":"Wiesbaden","marker":"erfa"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[9.92,49.80]},"properties":{"name":"Würzburg","marker":"erfa"}}
,
{"type":"Feature","geometry":{"type":"Point","coordinates":[8.53,47.39]},"properties":{"name":"Zürich","marker":"erfa"}}
]}

View File

@ -1,76 +0,0 @@
#!/usr/bin/env python3
from __future__ import print_function
from geopy import Nominatim
# ~ import json
import sys
#disable ssl verification
import ssl
import geopy.geocoders
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
geopy.geocoders.options.default_ssl_context = ctx
#/
# debug print to stderr, https://stackoverflow.com/questions/5574702/how-to-print-to-stderr-in-python
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
if len(sys.argv) == 2:
fn = sys.argv[1]
else:
eprint("in case you do not know what you are doing, better call via e.g. `create-geojson.sh`.\n");
eprint("expecting one argument: csv-file.");
eprint("received "+str(len(sys.argv))+" argument(s): "+str(sys.argv));
sys.exit(1) # exit with error
# for retreiving geo coordinates from addresses
geolocator = Nominatim(user_agent="vebit-mapper")
# lat: 0=111,1km; 1=11km; 2=1km… lng: 0=70km; 1=7km; 2=0,7km…
precision = 1
# convert csv to geojson
firstline = True
# start json list
print ( '{"type":"FeatureCollection","features":[' )
# get data from file
# ~ eprint( "opening: "+fn )
with open( fn, 'r' ) as fp:
for place in fp:
#error handling: expect
arrAddress = place.split(";")
strAddress1 = arrAddress[1]+" "+arrAddress[2]
strAddress2 = ",".join(arrAddress[3:5])
strAddress = strAddress1+","+strAddress2
eprint( "looking up: "+strAddress )
location = geolocator.geocode( strAddress )
if location is not None: # its a class
# done: ceil coords to hide true location in format string
# ~ strCoordPlace = '{:s},{:.6f},{:.6f}'.format( arrAddress[3], location.latitude, location.longitude )
# todo: auto deduplicate coords
# ~ strFormatGeoCoord = '{:.'+str(precision)+'f},{:.'+str(precision)+'f}';
# ~ strGeoCoord = strFormatGeoCoord.format( location.longitude, location.latitude )
geojson = '{{"type":"Feature","geometry":{{"type":"Point","coordinates":[{:.'+str(precision)+'f},{:.'+str(precision)+'f}]}},"properties":{{"name":"anonentry","marker":"veb-it"}}}}';
strCoordPlace = geojson.format( location.longitude, location.latitude )
if firstline == False :
print (",")
else:
firstline = False
print ( strCoordPlace )
# end json list
print ( "]}" )
# exit fine
sys.exit(0)
# ~ m = folium.Map( # etc..)
# ~ m.save("filename.png")
# ~ https://github.com/python-visualization/folium/issues/35#issuecomment-164784086
# ~ https://github.com/wbkd/leaflet-mapshot
# ~ https://stackoverflow.com/questions/44800396/python-ipyleaflet-export-map-as-png-or-jpg-or-svg
# ~ m = folium.Map(location=[51, 13], zoom_start=5, tiles='Stamen Toner') # Mapbox Bright , CartoDB Positron

View File

@ -1,34 +0,0 @@
#!/usr/bin/env python3
import math
def arc_to_deg(arc):
"""convert spherical arc length [m] to great circle distance [deg]"""
return float(arc)/6371/1000 * 180/math.pi
def deg_to_arc(deg):
"""convert great circle distance [deg] to spherical arc length [m]"""
return float(deg)*6371*1000 * math.pi/180
def latlon_to_xyz(lat,lon):
"""Convert angluar to cartesian coordiantes
latitude is the 90deg - zenith angle in range [-90;90]
lonitude is the azimuthal angle in range [-180;180]
"""
r = 6371 # https://en.wikipedia.org/wiki/Earth_radius
theta = math.pi/2 - math.radians(lat)
phi = math.radians(lon)
x = r * math.sin(theta) * math.cos(phi) # bronstein (3.381a)
y = r * math.sin(theta) * math.sin(phi)
z = r * math.cos(theta)
return [x,y,z]
def xyz_to_latlon (x,y,z):
"""Convert cartesian to angular lat/lon coordiantes"""
r = math.sqrt(x**2 + y**2 + z**2)
theta = math.asin(z/r) # https://stackoverflow.com/a/1185413/4933053
phi = math.atan2(y,x)
lat = math.degrees(theta)
lon = math.degrees(phi)
return [lat,lon]

View File

@ -1,15 +0,0 @@
#!/usr/bin/env sh
if="../non-public/eV/members.fods"
ofn=$(echo $if|rev|cut -d"/" -f1|cut -d"." -f2-|rev)
fae="file already exists."
# recv data
if test -e $ofn".csv" ; then
echo "$fae"
else
libreoffice --headless --convert-to csv:"Text - txt - csv (StarCalc)":"59,,76,3,1/1/2/2/2" $if || { echo "errors during export to csv"; exit 3; }
tail -n +2 ${ofn}".csv" | cut -d";" -f2,13-17|grep -e "^[v|g|n]" > ${ofn}".tmp"
mv ${ofn}".tmp" ${ofn}".csv" || { echo "error on removing first line."; exit 6; }
fi

View File

@ -1,41 +0,0 @@
#!/usr/bin/env python3
import math
# https://tools.ietf.org/html/rfc7946#page-12
# ~ latitude = 41.145556; // (φ)
# ~ longitude = -73.995; // (λ)
# Berlin 13.38,52.52 =>
lon = 13.38
lat = 52.52
# ~ mapWidth = 200;
# ~ mapHeight = 100;
w = 1000
h = 1000
def getMecatorPicCoords( lon, lat, w=1000, h=1000 ):
"""
transform coordinates in a mercator projection
for a picture with given size
"""
# get x value
# ~ x = (longitude+180)*(mapWidth/360)
x = (lon+180)*(w/360)
# convert from degrees to radians
# ~ latRad = latitude*PI/180;
# latRad = lat*math.pi/180 # used only once, so not stored in a variable
# get y value
# def ln(x): return math.log(x) # with single argument
# mercN = math.log(tan((math.pi/4)+(latRad/2))); # latRad integrated
# mercN = math.log(math.tan((math.pi/4)+(lat*math.pi/90))) # integrated as used once only
y = (h/2)-(w*math.log(math.tan((math.pi/4)+(lat*math.pi/90)))/(2*PI)) # mercN integrated
return (x,y)
# call the function
print( getMecatorPicCoords(x,y) )

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 4.1 MiB