Find Events by Latitude/Longitude and Radius

For this example, we will find conferences and expos that happened within a 2 mile radius of a specific location, in April 2018.

It can be difficult working out a suitable radius around your location so to make it easier please use our Suggested Radius API.

The Events endpoint supports the use of a within parameter to allow you to set specific latitude and longitude coordinates and search for events which occur within a radius from that point.

This can be used to find all the conferences and expos, category=conferences,expos, within 2 miles of my location, within=2mi@-37.80036998,144.9715749, that happened during April of 2018,active.gte=2018-04-01&active.lte=2018-04-30

import requests

response = requests.get(
    url="https://api.predicthq.com/v1/events/",
    headers={
      "Authorization": "Bearer $ACCESS_TOKEN",
      "Accept": "application/json"
    },
    params={
        "within" : "2mi@-37.80036998,144.9715749",
        "active.gte" : "2018-04-01",
        "active.lte" : "2018-04-30",
        "category" : "conferences,expos",
        "sort" : "rank"
    }
)

print(response.json())

A snippet of the results are shown below:

{
  "count": 734,
  "results": [
    {
      "id": "SwBTYbfiAHYDdbkUi7",
      "title": "Great Debate: Political Interest Society vs History Society",
      "category": "conferences",
      ...
    }
  ]
}

Last updated

© 2024 PredictHQ Ltd