I’m trying to add a custom geojson file to geomap. I don’t see a way to select my own file from the options so I located the dropdown options in the geojsonLayer.ts file and added my own value there. The new file is located in the same /public directory as the other .geojson map files. However, this does not result in the expected behavior of that value being available. I’ve restarted the Grafana server thinking that might result in the uptake of the new TS file but no joy there.
What is the proper way to add a custom geojson file to Geomap? If it is editing the geojsonLayer.ts file how does one make the new option available?
I am having the same issue.
I am having the same issue
It seems the choices are embedded in the code, however as a workaround custom files are permited if you upload your file to the folder (be aware that you can not delete the text in the GeoJSON URL selection box, you need to directly click and start writting the path and filename). At least that work for us. Thanks Grafana geojson team for working on the tool and to Peancor for finding this workaround.
Can you specify your workaround a little more:
- To which folder? The gazetteer folder?
- Write the file/path name where?
Did anyone encounter: “Unable to parse locations” if you replaced one of the existing .json files with a custom one? I think it is not an issue with my json format.
In our case the file was uploaded to the “/public/gazetteer” folder, and in the GEOMAP option of data layer we typed the Geojson URL as: /public/gazetteer/image.geojson
Hope it helps!
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 pandas as pd
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')
I have set up a server that serves geoJSON files and thought that I could have grafana query my server for the files by adding the url to the server as stated above, but it does not show me anything. Have anyone managed to do this?
i can enter my files no problem.
has anyone been able to pass a variable into the GeoJSON URL
or is my syntax off.
A node server or what kind of server?
Can this work with a servwr that serves geojson files? Make it grab different routes?