Adding custom geojson to Geomap

Thanks! It’s hard to notice that one can write a custom path there.

If anybody is trying to get it to work with german postal codes:
Get the file DE.tab here:

And then run the following python script in that folder:

import sys
import pandas as pd
import json

dat = pd.read_csv("DE.tab",sep='\t')
dat = dat[dat["plz"].notnull()]
dat = dat[dat["lat"].notnull()]
dat = dat[["plz","lat","lon","name"]]
dat.columns = ["key","latitude","longitude","name"]

for i,row in dat.iterrows():
    if "," in row["key"]:

        for alt in row["key"].split(','):
            tmp = row.copy()
            tmp["key"] = alt
            dat = dat.append(tmp,ignore_index=True)


dat = dat[~dat["key"].str.contains(",")]

parsed = json.loads(dat.to_json(orient='records'))
tmp = json.dumps(parsed, indent=4, ensure_ascii=False).encode('utf8')

print(tmp.decode())
1 Like