Skip to main content

Concept

Geographic targeting

Two specialty filters target records by coordinates: a radius around a point, or any closed polygon. They're available on Consumer and Business data sources and slot into the standard filters array.

Where these work

The coordinate_radius and polygon filters are exposed on Consumer (data source 4) and Business (data source 2). Other data sources rely on zip, county, metro, and state filters instead. Check GET /api/v1/data_sources/:id for the exact field list.

Radius around a point

Pass one string of the form "lat,lng,radiusMiles". The lat/lng is in decimal degrees and the radius is in U.S. statute miles. Only the first entry in values is used; extra entries do not add circles.

25 miles around Thousand Oaks, CA
{
  "filters": [
    { "field": "coordinate_radius", "values": ["34.1365,-118.7487,25"] }
  ]
}

For several points with their own radii, send one coordinate_radius filter per point and give them the same named condition, such as centers. Those filters combine with OR, so a record matches if it falls in any circle. A record inside two overlapping circles is counted once.

10 miles around San Francisco or 5 miles around Los Angeles
{
  "data_source_id": 4,
  "filters": [
    { "field": "coordinate_radius", "values": ["37.7749295,-122.4194155,10"], "condition": "centers" },
    { "field": "coordinate_radius", "values": ["34.052235,-118.243683,5"], "condition": "centers" }
  ]
}

Arbitrary polygons

For non-circular regions, use polygon with an ordered array of "lat,lng" vertex strings. The polygon is automatically closed if the last point isn't equal to the first.

A bounding box around west LA
{
  "filters": [
    {
      "field": "polygon",
      "values": [
        "34.05,-118.25",
        "34.05,-118.15",
        "34.15,-118.15",
        "34.15,-118.25"
      ]
    }
  ]
}

Use polygons for irregular service areas, congressional districts, or custom trade zones. A polygon may have at most 10,000 vertices. Simplify detailed shapes before submitting.

Combining with other filters

Geographic filters are ordinary filters: they live in the same array as everything else and combine with AND by default. Drop them into a named condition group to OR them with a non-geographic predicate.

Homeowners within a polygon or in zip 91361
{
  "filters": [
    { "field": "homeowner", "values": ["Y"] },
    { "field": "polygon",   "values": ["34.05,-118.25", "34.05,-118.15", "34.15,-118.15", "34.15,-118.25"], "condition": "geo" },
    { "field": "zip",       "values": ["91361"], "condition": "geo" }
  ]
}

Used by