congressapi / legislators.allForLatLong

legislators.allForLatLong is a shortcut method that returns all legislators that currently represent an area (district or state) that contains a given point. Typically this means it will return two senators and one representative. This is the same data that could be retrieved by using districts.getDistrictsFromLatLong in combination with legislators.get and getList.

This method was added because it seems to be a common pattern to want all of an individuals representation (see also legislators.allForZip).

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

legislators.allForLatLong.json?latitude=35.778788&longitude=-78.787805