Map your contacts to UK geographical areas

Veröffentlicht
2026-01-13 07:35
Written by
wmortada - member of the CiviCRM community - view blog guidelines

Do you want to know how many members you have in each UK county or region? Perhaps you would like to send a targeted mailing to contacts in a specific parliamentary constituency? If so, please read on.

Third Sector Design is planning to build an extension for CiviCRM that puts all contacts into UK geographical areas based on their postcode. This will allow organisations to segment their contacts by local authority, ward, county, region etc. This makes it much easier to create reports on how many contacts you have in each area or to segment contacts by area for mailings.

This is hard to do out of the box in CiviCRM as postcode areas don’t map neatly onto political and local authority boundaries. However, there is a service called MapIt that gives you the political, local authority and health areas for a given postcode. To see this in action take a look at EX1 1DF for example. We plan to create an extension for CiviCRM that adds UK geographical areas to contact records using the MapIt API so that these areas will be easily accessible alongside your contact data within CiviCRM.

We intend to support the following use cases with this extension:

  • A membership organisation wants to report on how many members they have in each of the UK regions and local authority areas.
  • A campaigning organisation would like to contact all supporters in a particular constituency to ask them to email their MP on a certain topic.
  • A community organisation wishes to invite contacts that are residents of a specific ward to an event about their local area.
  • A coop has plans to advertise opportunities to get involved with their work to residents in specific London boroughs.

The above are examples of the sort of functionality that this extension will support but it should work for other similar use cases and other area types.

The MapIt API is free to use for up to 50 API calls per day. There are tiered charges for higher volume usage with discounts for UK charities and non-profits (free use for charities for up to 10,000 calls per month).

The functionality is limited to the UK initially. However, it could potentially be extended to other countries if there is a suitable API that provides similar data.

We are looking for organisations that would be interested in funding the development costs of this extension. Please get in touch if your organisation would find this useful. Send an email to William Mortada on williammortada@thirdsectordesign.org.

Image credit: "Gross Disposable Household Income (GDHI) across the UK mapped in 2020" by Tweedledumb2 is licensed under CC BY-SA 4.0 / key removed from original.

Comments

For anyone wanting a cheaper solution, I have an extension that does a very similar thing, but using the (completely) free Postcodes.io service.

Extension: https://codeberg.org/artfulrobot/postcodesio

What it does is ensures that for every address, Civi has the data from postcodes.io, which looks like this:
https://api.postcodes.io/postcodes/sw1a0aa

Currently it's left to the implementor to set up a hook to do what they want with this data, for example, you might extract the geographical area to one custom field, making it searchable, and perhaps the parliamentary constituency and other fields.

I'm informed that the data in postcodes.io may not be as up-to-date as the MapIt data, though, so your suggestion of a MapIt based extension is a valuable addition to the Civi ecosystem.

2026-01-14 - 09:46

It seems we have an embarrassment of riches in this area. The Electoral extension is an API agnostic extension that simply manages the lookup and updating of contract records. Currently it supports Cicero, Google, and OpenStates (US only) but it could support more. See: https://lab.civicrm.org/extensions/electoral

Thanks for sharing this alternative, Artful Robot. It's good to have options. Postcodes.io looks like a useful service but it doesn't appear to have the same detail as the MapIt API for example it appears to group unitary authorities, metropolitan districts and county councils together rather than distinguishing between them. This may or may not be helpful depending on your use case.

Just to be clear, the MapIt API is free for charities for up to 10,000 calls per month and for anyone for up to 50 calls per day.

Thanks Jamie. I wasn't aware of that extension but will take a look.

Hello Michael & William,

We've done something that sounds really close to this for Community Transport Association! Circle Interactive did the technical build. Our plan was always to share it but wanted to give it a chance to run and ensure it's working in a stable way. Let me reach out to the team who helped build this and see where the repository is so we can get it shared.

And as far as I remember, it was really easy for them to sign up on the free charity plan. We restricted the calls to a specific CiviCRM groups to ensure they stayed within the free threshold.

Sounds great Heather. It would be really helpful if you could share the details.

Just in case anyone else is following this tread ... we're working on getting this into a sharable format :)

Thanks Heather! I'm taking a look.

Discussion

No comments yet.