Product

Radar geocoding, search, and distance APIs, now in private beta

by

Nick Patrick

on

February 11, 2020

Radar started as a geofencing platform. Over time, we've added more location context types: Places (for place, chain, and category detection), Insights (home, work, and traveling detection), and Regions (country, state, DMA, and postal code detection).

However, our customers have asked for more building blocks. Today, we're excited to launch the private beta of several new APIs: geocoding, search, and distance.

api

These APIs will be available server-side and client-side in SDK v3, also announced today.

Geocoding

Existing geocoding APIs are complicated, restrictive, and expensive.

So, we're introducing simple, flexible geocoding APIs: forward (convert address to coordinates), reverse (convert coordinates to address), and IP (convert IP address to country).

GET https://api.radar.io/v1/geocode/forward
GET https://api.radar.io/v1/geocode/reverse
GET https://api.radar.io/v1/geocode/ip

For example, a real estate app could convert 20 jay st brooklyn to a complete address with coordinates:

curl "https://api.radar.io/v1/geocode/forward?query=20 jay st brooklyn" \
  -H "Authorization: prj_live_pk_..."
{
  "meta": {
    "code": 200
  },
  "addresses": [
    {
      "latitude": 40.70390,
      "longitude": -73.98670,
      "geometry": {
        "type": "Point",
        "coordinates": [-73.98670, 40.70390]
      },
      "formattedAddress": "20 Jay Street, Brooklyn, New York, NY 11201 USA",
      "country": "United States",
      "countryCode": "US",
      "countryFlag": "🇺🇸",
      "state": "New York",
      "stateCode": "NY",
      "postalCode": "11201",
      "city": "New York",
      "borough": "Brooklyn",
      "county": "Kings County",
      "neighborhood": "DUMBO",
      "number": "20",
      "confidence": "exact"
    }
  ]
}

An e-commerce app could pre-fill a checkout form based on the device's current location:

Radar.reverseGeocode { (status, addresses) in
  // do something with addresses
}

Or, a travel app could localize in-app content based on device IP address:

Radar.ipGeocode { (status, country) in
  // do something with country?.code
}

We're also introducing search APIs to search geofences, users, places, and addresses.

GET https://api.radar.io/v1/search/geofences
GET https://api.radar.io/v1/search/users
GET https://api.radar.io/v1/search/places
GET https://api.radar.io/v1/search/autocomplete

For example, a shopping app with store geofences could power a store locator with geofence search:

Radar.searchGeofences(
  tags: ["store"],
  limit: 10
) { (status, geofences) in
  // do something with geofences
}

A social app could power "find my friends" with user search:

curl "https://api.radar.io/v1/search/users?near=40.78382,-73.97536&radius=1000&limit=10" \
  -H "Authorization: prj_live_sk_..."

Or, a ride sharing app could power a destination selector with address autocomplete:

curl "https://api.radar.io/v1/search/autocomplete?query=brooklyn roasting&near=40.70390,-73.98670" \
  -H "Authorization: prj_live_pk_..."
{
  "meta": {
    "code": 200
  },
  "addresses": [
    {
      "latitude": 40.70390,
      "longitude": -73.98670,
      "geometry": {
        "type": "Point",
        "coordinates": [-73.98670, 40.70390]
      },
      "name": "Brooklyn Roasting Company",
      "formattedAddress": "25 Jay Street, Brooklyn, New York, NY 11201 USA",
      "country": "United States",
      "countryCode": "US",
      "countryFlag": "🇺🇸",
      "state": "New York",
      "stateCode": "NY",
      "postalCode": "11201",
      "city": "New York",
      "borough": "Brooklyn",
      "county": "Kings County",
      "neighborhood": "DUMBO",
      "number": "25",
      "confidence": "exact"
    }
  ]
}

Distance

Finally, we're introducing a distance API to calculate the travel distance between two locations.

GET https://api.radar.io/v1/route/distance

For example, a restaurant app could power ETAs for order ahead:

curl "https://api.radar.io/v1/route/distance?origin=40.78382,-73.97536&destination=40.70390,-73.98690&modes=foot,car&units=imperial" \
  -H "Authorization: prj_live_pk_..."
{
  "meta": {
    "code": 200
  },
  "routes": {
    "geodesic": {
      "value": 29568,
      "text": "5.6 mi"
    },
    "foot": {
      "distance": {
        "value": 35367,
        "text": "6.7 mi",
      },
      "duration": {
        "value": 137,
        "text": "2 hr 17 min"
      }
    },
    "car": {
      "distance": {
        "value": 50160,
        "text": "9.5 mi"
      },
      "duration": {
        "value": 32,
        "text": "32 min"
      }
    }
  }
}

Want to participate in the private beta? Request beta access here.

Want to stay in the loop about public launches? Subscribe to the newsletter below.

We can't wait to see what you'll build!

It's time to build

See what Radar’s location and geofencingsolutions can do for your business.