🗳️ local government political party finder
14 Jul 2025 • 3 min read
find local politics by map
Curious about local politics around the world? Press a location on the map to query wikidata! NOTE: This doesn't always return results, and when it does they can be slow to arrive, plus their temporal/spatial accuracy can be out of date/place due to old data or spatial oddities, since the match is inferred by proximity to a local admin headquarters, which could be in a another area entirely, yet still closer than the actual one… Still, do give it a spin, wikidata is amazing after all. TIP: Zoom to a locality first.
Making this map was fun; it started on a journey from Suffolk to London. On the way I visited Flatford Mill and became curious about what the local politics were like. This soon turned into curiosity about what the local politics are like anywhere. Amazingly, if not always consistently, wikidata covers this! With some much needed sparql chops from le chat, I eventually settled on a query that addresses this curiosity by tracking the party of the head of local government in the proximity of a geolocation.
SELECT DISTINCT ?location ?adminArea ?adminAreaLabel ?headPartyMembership ?headPartyMembershipLabel ?officialWebsite ?governingPartyWebsite
WHERE {
SERVICE wikibase:around {
?adminArea wdt:P625 ?location .
bd:serviceParam wikibase:center "Point(${longitude} ${latitude})"^^geo:wktLiteral .
bd:serviceParam wikibase:radius "8" .
bd:serviceParam wikibase:distance ?distance .
}
# Get administrative type
?adminArea wdt:P31 ?adminType .
# Must be an administrative entity
?area wdt:P31/wdt:P279* ?type .
?type wdt:P279* wd:Q34876 .
# Get the head of government and their party (if available)
{
# Get the head of government (P6)
?adminArea wdt:P6 ?governingParty .
# Get the party membership of the head of government (if available)
{
?governingParty wdt:P102 ?headPartyMembership .
}
}
# Get the official website (P856)
OPTIONAL {
?adminArea wdt:P856 ?officialWebsite .
}
# Get the official website of the governing party (P856)
OPTIONAL {
?governingParty wdt:P856 ?governingPartyWebsite .
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
ORDER BY ?distance
LIMIT 1
Making this map was also fiddly; Sourcehut pages have a disciplined and excellent content security policy which means that:
All scripts and styles must be loaded from your own site, not a CDNFine by me, but when using maplibre this policy also applies to map tiles, fonts, sprites etc. Initially I'd hoped this might provide a perfect reason to use protomaps (I was fortunate enough to meet the creator, bdon, at geomob and his approach is great). Limiting zoom to level 6, which is close enough for cities, means you can tile the world in just 42MB! Unfortunately this policy also precludes queries to wikidata, so in the end I used an iframe to codeberg and standard tiles from maptiler's content distribution network. Nonetheless tinkering with protomaps is nice, and I'll look forward to making some data enriched tiles when the opportunity arises.