congressapi / districts.getDistrictFromLatLong

districts.getDistrictFromLatLong gets the district that a provided latitude/longitude pair falls within.

Parameters

There are two required parameters for getDistrictFromLatLong:

  • latitude: latitude of coordinate
  • longitude: longitude of coordinate

Errors

Errors are indicated by setting the HTTP status code to 400 and returning a text string describing the error. The following errors may be encountered in districts.getZipsFromDistrict:

  • Missing Parameter: returned if latitude or longitude parameter is not provided
  • Point not within a congressional district: Point does not fall within a congressional district

Examples

districts.getDistrictFromLatLong.xml?latitude=35.778788&longitude=-78.787805

<response>
  <districts>
    <district>
      <state>NC</state>
      <number>4</number>
    </district>
  </districts>
</response>

districts.getDistrictFromLatLong.json?latitude=35.778788&longitude=-78.787805

{"response": 
    {"districts": 
        [{"district": {"state": "NC", "number": "4"}}]
    }
}