How to make nice GeoJSON tooltips on the map #108
Moonbase59
started this conversation in
Show and tell
Replies: 2 comments 13 replies
-
Can you do this for lines? I plan to add all major interstates on a planning map I'm using, and even though I know them quite well, it could be useful to have the names on them. If so, where in the file? The I-90 json file starts like this:
|
Beta Was this translation helpful? Give feedback.
5 replies
-
Is offline map supported? |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The Obsidian Leaflet plugin takes tooltip titles from the GeoJSON feature properties, namely
name
ortitle
.OpenDataLab (and other) GeoJSON data received from official institutions like the land surveyor’s office often doesn’t have a
name
property. Fortunately, we can often construct it from other existing feature properties, likeBEZ
andGEN
for district ("Landkreis") data, in our example.Our file
geo-bayern-landkreise.geojson
(converted to a readable format) has the following structure:We can see there are neither
name
nortitle
feature properties, but we can construct a meaningful name by concatenating theBEZ
andGEN
properties.Since manual editing is much too error-prone and awfully slow, and the data is JSON, we can easily use a little Python3 to do that job for us. Always backup your original GeoJSON file before, and work on copies!
Now the relevant feature properties look like this:
We can see the
name
property has been added just as we wanted, and will now display when using this GeoJSON file within an Obsidian Leaflet map:This principle can be applied to any GeoJSON data you might encounter—it’s only JSON data, after all, and can be easily processed.
Happy surveying!
Beta Was this translation helpful? Give feedback.
All reactions