Place boundaries on the map stored as GeoJSON objects

Hello everyone, first post here though I’ve been reading along for a while. I’ve used Gramps Web for just over a year and run a multi-tree server with it for a group I coordinate researching Norwegian ancestry. It has been excellent for us, and I’ve been building a few tools (GitHub - petermgrund/bifrost: Companion app for Gramps Web that bridges a family tree to outside services · GitHub) for our Gramps Web instance intended to connect to other open source software like Immich and Paperless-ngx, which stores all of our genealogical media. One feature has turned into something I’d like to ask about, though, as trying to implement it myself has been tricky.

When a place is a county, a state or a country, the place page shows it as a single pin at its coordinates, which looks oddly precise and doesn’t show the extent of the place. On my own instance I’ve been running a small hack that draws the boundary polygon instead:

The hack works by injecting a script into the frontend. The actual boundary comes from the OSM relation. It’s fragile, but works for now.

I want to see, though, if there is any interest in trying to fold this feature into Gramps Web. If so, my initial thought would be to a place’s boundary as a media object attached to the place the same way it already does for a historical map image, making it into a map overlay through a media object with a map:bounds attribute. The media object would be a GeoJSON file that sits in the place’s media list so it exports with your tree and syncs to Gramps desktop. I think this would avoid any server or API changes needed. The place page then draws it as a filled outline on the minimap. Places without one keep just the pin so nothing would change there.

Getting the shapefile file would be up to you. You could export it from OpenStreetMap for the relation that matches the place or let a tool do it. My GitHub repo I referenced above builds these from a place’s OSM relation URL.

And, as we know, boundaries change over time. Gramps media objects carry a date and Gramps dates can be spans, so a place could hold several boundary files and the map could show the one matching the year in view like the year that already drives the OpenHistoricalMap layer and the time slider.

Before I open a feature request I’d like to know if there would be interest from the project’s developers in this feature, if others would use it, and any thoughts from the community.

Thanks for your time and work on this project.

Here is my version information:
Gramps 6.0.8
Gramps Web API 3.21.1
Gramps Web Frontend 26.8.1
Gramps QL 0.5.0
Sifts 1.3.1
locale: en
multi-tree: true
task queue: true
OCR: true
chat: true

That is a great idea, and has already been added to gramps, and to Gramps Connect! The standard so far is to add Keyhole Markup Language (KML) as a note, to a place, and they will automatically draw on the map. Gramps Connect also allows creating and editing the KML objects.

Hi Peter,

thanks for sharing!

As you noticed I’ve invested a lot of work into improving the Gramps Web map view and there is still a lot of potential. This is not something I have thought of, so it’s definitely an interesting idea.

What I find a bit problematic is that this is in tension with Gramps’ data model - a place in Gramps is supposed to have a single coordinate pair, so it’s a point on the map. I am skeptical Gramps is the right tool to store geographic boundaries of administrative units - and I would also say this is not genealogical data, but historical data. And there is already a fantastic project holding that data as GeoJSON, namely OpenHistoricalMap. So in this specific case, I would find it more logical to associate the Gramps place with an OHM object via its ID and display the data from there.

You might also be interested in my parallel project Domus - I’m planning to add Wikidata places to Gramps Web in the near future.