Welcome to Tris's US Legislative District Matching Emporium
Have you ever had a (latitude, longitude) coordinate and needed to know what United States legislative districts represented the folks living at that coordinate? You may be entitled to financial compensation benefit from this API!
How to use
Best explained as an example, with curl
:
$ curl -A "mycoolsoftware/1.1 your.contact.email@whatever.com" \
"https://districts.socialism.gay/v1/match.json?lat=38.762&lon=-77.593"
{
"ocdids": [
"ocd-division/country:us/state:va",
"ocd-division/country:us/state:va/cd:10",
"ocd-division/country:us/state:va/sldl:22",
"ocd-division/country:us/state:va/sldu:30"
],
"perf": {
"match_time_ms": 10.716
}
}
Please note the following from this example:
-
The response will contain a list of OCD Identifiers.
- The district number prefixes mean the following:
cd
is a Congressional District
sldl
is a State Legislative District (Lower house, like a General Assembly or State House of Representatives)
sldu
is a State Legislative District (Upper house, like a State Senate)
- There are a few oddities in the OCD Identifier set that you should be aware of:
- DC is a
district:dc
, not a state:dc
. It has sldu
districts which correspond to DC Council wards.
- States that only have at-large congressional districts use
cd:at-large
instead of a numbered district (Alaska, Delaware, North Dakota, South Dakota, Vermont, Wyoming).
- Massachusetts, Vermont, and New Hampshire
sldl
and sldu
identifiers are based on the towns the districts consist of.
- Vermont does the same with their
sldu
identifiers.
- Nebraska has a unicameral legislature, so they only have
sldu
identifiers.
- You must send a User-Agent header (the
-A
option to curl
) that includes your contact email. Otherwise you might be blocked from using the API based on someone else's abuse.
- All values in the
perf
section are subject to change at any time, with no warning. All other keys should be ~stable.
Terms of use
- The only permitted uses of this service are the following. If your use doesn't fall under one of these categories, email the address listed below.
- Providing support to progressive political campaigns (issue campaigns count) in the US.
- Understanding and counteracting partisan gerrymandering in the US.
- Nonpartisan personal or research use.
- You should be reasonable with your request rates (try to keep it at less than 60 requests per minute, if you need more please send me an email).
Known limitations
- If you hit a state that isn't in cache it'll be slow. Cache lasts for a while though, and matching should be very fast (100/s or greater)
- US territories aren't properly supported right now.
- No data on representatives is provided currently, just the districts. I'd recommend the Open States People dataset (and maybe I'll add support for this dataset in the future)!
- District borders and OCD-IDs are correct to the best of my knowledge and ability. Districts should be current for the 118th Congress / 2022 redistricting cycle, except for states that are (or have been, in 2022/2023) in litigation over their maps.
- Only congressional districts and state legislative districts are provided. I'd love to talk about adding city council and county commission districts! Just send me an email.
Feedback
You can email district-matcher-help@tris.fyi
for best-effort support, bug reports, data quality issues, and so on.
Acknowledgements