Filtering

Attributes

POIs can have custom attributes, which allows you to store additional information about the location. For example, you could store the opening hours of a restaurant or the price range of a hotel. You can use the custom attributes to indicate what's the owner of the POI, or to store different locations for each of your clients.

These attributes can be used to filter the POIs, so you can show only the ones that are relevant to the user. Check the attribute resource to learn more about how to manage the attributes of your POIs.

Filter POIs by attributes

  • Name
    <attribute_name>
    Type
    string
    Description

    The name of the attribute you want to filter by.

  • Name
    <attribute_id>
    Type
    integer
    Description

    The ID of the attribute you want to filter by.

Request POIs by attribute

# Filter by attribute name
curl -G https://api.lanewise.app/v1/pois \
  -H "X-API-KEY: {YOUR_API_KEY}" \
  -d "owner_id=123"

# Filter by attribute ID
curl -G https://api.lanewise.app/v1/pois \
  -H "X-API-KEY: {YOUR_API_KEY}" \
  -d "1=123"

Response

{
  "data": [
    {
      "id": "LpaJXbYb9wQrEFuM",
      "attributes": {
        "owner_id": "123",
      },
      // ...
    },
  ],
  "next": null,
}

Categories

POIs can also have categories, which allows you to group them by type. For example, you could have a category for restaurants, another for parks, and another for museums. While this is optional, it can help you to organize your POIs and to filter them by type.

Filter POIs by category

  • Name
    category_id
    Type
    integer
    Description

    The ID of the category you want to filter by.

  • Name
    category_name
    Type
    string
    Description

    The name of the category you want to filter by.

Request POIs by category

# Filter by category ID
curl -G https://api.lanewise.app/v1/pois
  -H "X-API-KEY: {YOUR_API_KEY}" \
  -d "category_id=123"

# Filter by category name
curl -G https://api.lanewise.app/v1/pois
  -H "X-API-KEY: {YOUR_API_KEY}" \
  -d "category_name=restaurant"

Response

{
  "data": [
    {
      "id": "LpaJXbYb9wQrEFuM",
      "category_id": "123",
      // ...
    },
  ],
  "next": null,
}

Geolocation

POIs references a location in the real world. Our data enrichment process will automatically add the geolocation of the POI based on the coordinates you provide, including the address, city, and country. After that, you can use the geolocation to filter the POIs by distance, so you can show only the ones that are near the user. You can also filter the POIs by the country or city, so you can show only the ones that are in a specific location.

Filter POIs by geolocation

  • Name
    latitude
    Type
    float
    Description

    The latitude of the location you want to filter by.

  • Name
    longitude
    Type
    float
    Description

    The longitude of the location you want to filter by.

  • Name
    distance
    Type
    integer
    Description

    The distance in meters from the location you want to filter by.

  • Name
    country_id
    Type
    integer
    Description

    The country ID of the location you want to filter by.

  • Name
    city_id
    Type
    integer
    Description

    The city ID of the location you want to filter by.

Request POIs by geolocation

# Filter by latitude and longitude
curl -G https://api.lanewise.app/v1/pois
  -H "X-API-KEY: {YOUR_API_KEY}" \
  -d "latitude=37.7749" \
  -d "longitude=-122.4194"

# Filter by distance
curl -G https://api.lanewise.app/v1/pois
  -H "X-API-KEY: {YOUR_API_KEY}" \
  -d "latitude=37.7749" \
  -d "longitude=-122.4194" \
  -d "distance=1000"

# Filter by country
curl -G https://api.lanewise.app/v1/pois
  -H "X-API-KEY: {YOUR_API_KEY}" \
  -d "country_id=1"

# Filter by city
curl -G https://api.lanewise.app/v1/pois
  -H "X-API-KEY: {YOUR_API_KEY}" \
  -d "city_id=2"

Response

{
  "data": [
    {
      "id": "LpaJXbYb9wQrEFuM",
      "latitude": 37.7749,
      "longitude": -122.4194,
      "display_name": "San Francisco, CA, USA",
      // ...
    },
  ],
  "next": null,
}