geo_radius

DPU:

0.5

Purpose:

To filter for posts originating inside a circle. You specify the radius of the circle in kilometers (km) and the center as a pair of latitude and longitude coordinates.

1 mile = 1.6 km.

Case:

Not case sensitive.

Syntax:

geo_radius(latitude, longitude : radius)

Note the use of the comma and colon. Spaces and new lines in the argument are ignored.

Examples:

  1. Filter for clicks on bitly links from users within 50 kilometers of Reading:

    bitly.geo geo_radius "51.4553,-0.9689:50"

  2. Filter for clicks on bitly links from users within 250 kilometers of New York City:

    bitly.geo geo_radius "40.78, -73.97:250"

  3. Filter for interactions originating within 50 kilometers of the 10 largest US cities. Notice that we have tagged each output object, adding location metadata that can be analyzed by your client code:

    tag "New York City" {interaction.geo geo_radius "40.73141253955102,-73.9975634765625:50"}
    tag "Los Angeles"   {interaction.geo geo_radius "34.04557362447603,-118.25323974609375:50"}
    tag "Chicago"       {interaction.geo geo_radius "41.87137359046374,-87.670048828125:50"}
    tag "Houston"       {interaction.geo geo_radius "29.749799863884224,-95.36322509765625:50"}
    tag "Philadelphia"  {interaction.geo geo_radius "39.95583044348851,-75.145634765625:50"}
    tag "Phoenix"       {interaction.geo geo_radius "33.475866285896466,-112.07755004882813:50"}
    tag "San Antonio"   {interaction.geo geo_radius "29.472807218822343,-98.49982177734375:50"}
    tag "San Diego"     {interaction.geo geo_radius "32.75467986374471,-117.1848193359375:50"}
    tag "Dallas"        {interaction.geo geo_radius "32.8285647393374,-96.7996875:50"}
    tag "San Jose"      {interaction.geo geo_radius "37.32187207146947,-121.88971435546875:50"}
    
    return {
      // New York
      interaction.geo geo_radius "40.73141253955102,-73.9975634765625:50"
      // Los Angeles
      or interaction.geo geo_radius "34.04557362447603,-118.25323974609375:50"
      // Chicago
      or interaction.geo geo_radius "41.87137359046374,-87.670048828125:50"
      // Houston
      or interaction.geo geo_radius "29.749799863884224,-95.36322509765625:50"
      // Philadelphia
      or interaction.geo geo_radius "39.95583044348851,-75.145634765625:50"
      // Phoenix
      or interaction.geo geo_radius "33.475866285896466,-112.07755004882813:50"
      // San Antonio
      or interaction.geo geo_radius "29.472807218822343,-98.49982177734375:50"
      // San Diego
      or interaction.geo geo_radius "32.75467986374471,-117.1848193359375:50"
      // Dallas
      or interaction.geo geo_radius "32.8285647393374,-96.7996875:50"
      // San Jose
      or interaction.geo geo_radius "37.32187207146947,-121.88971435546875:50"
    }