Radar’s search APIs allow you to find places, geofences, and business locations near a given point with powerful filtering capabilities.
Search Places
Search for places near a location, sorted by distance. You can filter by chains, categories, groups, and countries.
Basic Place Search
Search for places within a radius using the device’s current location:
Radar. searchPlaces (
radius : 1000 ,
chains : nil ,
categories : [ "restaurant" ],
groups : nil ,
countryCodes : nil ,
limit : 10
) { status, location, places in
if status == .success {
places ? . forEach { place in
print ( "Place: \( place. name ) " )
print ( "Categories: \( place. categories . joined ( separator : ", " ) ) " )
}
}
}
Search by Chain
Find specific restaurant or retail chains near a location:
Radar. searchPlaces (
radius : 5000 ,
chains : [ "mcdonalds" , "starbucks" ],
categories : nil ,
groups : nil ,
countryCodes : [ "US" ],
limit : 20
) { status, location, places in
if status == .success {
places ? . forEach { place in
print ( "Chain: \( place. chain ? . name ?? "Unknown" ) " )
print ( "Address: \( place. address ? . formattedAddress ?? "" ) " )
}
}
}
Filter chains by custom metadata attributes:
Radar. searchPlaces (
radius : 1000 ,
chains : [ "mcdonalds" ],
chainMetadata : [ "orderActive" : "true" ],
categories : nil ,
groups : nil ,
countryCodes : [ "US" ],
limit : 10
) { status, location, places in
if status == .success {
places ? . forEach { place in
print ( "Place: \( place. name ) " )
if let metadata = place.chain ? .metadata {
print ( "Metadata: \( metadata ) " )
}
}
}
}
Search Near a Specific Location
Search for places near coordinates other than the device’s current location:
let searchLocation = CLLocation ( latitude : 40.7128 , longitude : -74.0060 )
Radar. searchPlaces (
near : searchLocation,
radius : 2000 ,
chains : nil ,
categories : [ "cafe" , "restaurant" ],
groups : nil ,
countryCodes : [ "US" ],
limit : 15
) { status, location, places in
if status == .success {
places ? . forEach { place in
print ( " \( place. name ) : \( place. categories . joined ( separator : ", " ) ) " )
}
}
}
Search Parameters
Radius
Search radius in meters. Must be between 100 and 10,000 meters.
Chains
Array of chain slugs to filter. Cannot be combined with categories or groups.
Categories
Array of place categories to filter. Cannot be combined with chains or groups.
Groups
Array of place groups to filter. Cannot be combined with chains or categories.
Country Codes
Array of ISO 3166-1 alpha-2 country codes to filter results.
Limit
Maximum number of results to return. Must be between 1 and 100.
You can only specify one of chains, categories, or groups per search request.
Search Geofences
Search for geofences near a location, sorted by distance. This is useful for finding nearby custom regions.
Basic Geofence Search
Search for all geofences near the device’s current location:
Radar. searchGeofences { status, location, geofences in
if status == .success {
geofences ? . forEach { geofence in
print ( "Geofence: \( geofence. __description ) " )
print ( "Tag: \( geofence. tag ?? "None" ) " )
print ( "External ID: \( geofence. externalId ?? "None" ) " )
}
}
}
Advanced Geofence Search
Search with filters for tags, metadata, radius, and result limits:
let searchLocation = CLLocation ( latitude : 40.7128 , longitude : -74.0060 )
Radar. searchGeofences (
near : searchLocation,
radius : 1000 ,
tags : [ "store" , "venue" ],
metadata : [ "type" : "retail" ],
limit : 50 ,
includeGeometry : false
) { status, location, geofences in
if status == .success {
print ( "Found \( geofences ? . count ?? 0 ) geofences" )
geofences ? . forEach { geofence in
print ( "Geofence: \( geofence. __description ) " )
if let metadata = geofence.metadata {
print ( "Metadata: \( metadata ) " )
}
}
}
}
Geofence Search Parameters
Parameter Type Description nearCLLocation?Search location (nil uses current location) radiusIntSearch radius in meters (100-10000, or -1 for unlimited) tags[String]?Array of tags to filter metadata[String: Any]?Dictionary of metadata to filter limitIntMaximum results (1-1000, default 100) includeGeometryBoolInclude geometry in response (set to false for >100 results)
Set includeGeometry to false if you only need geofence metadata and not the actual boundaries. This improves performance and allows returning more than 100 results.
Place Categories
Radar supports hundreds of place categories across different verticals:
Food & Drink
restaurant, cafe, bar, fast-food, bakery, brewery
Retail
clothing-store, grocery-store, pharmacy, convenience-store
Services
bank, atm, gas-station, car-wash, post-office
Health & Fitness
gym, hospital, doctor, dentist, spa
Entertainment
movie-theater, museum, park, stadium, casino
Transportation
airport, train-station, bus-station, parking
View all categories →
Working with Search Results
RadarPlace Properties
The RadarPlace object contains comprehensive information about each place:
Radar. searchPlaces ( ... ) { status, location, places in
if let place = places ? . first {
// Basic info
print ( "ID: \( place. _id ) " )
print ( "Name: \( place. name ) " )
print ( "Categories: \( place. categories ) " )
// Chain information
if let chain = place.chain {
print ( "Chain: \( chain. name ) " )
print ( "Chain slug: \( chain. slug ) " )
print ( "Chain metadata: \( chain. metadata ?? [ : ] ) " )
}
// Location
print ( "Coordinate: \( place. location . coordinate ) " )
// Address
if let address = place.address {
print ( "Address: \( address. formattedAddress ?? "" ) " )
}
// Group and metadata
if let group = place.group {
print ( "Group: \( group ) " )
}
if let metadata = place.metadata {
print ( "Metadata: \( metadata ) " )
}
}
}
Checking Place Properties
RadarPlace provides convenience methods for checking chains and categories:
if let place = places ? . first {
// Check if place is part of a specific chain
if place. isChain ( "starbucks" ) {
print ( "This is a Starbucks location" )
}
// Check if place has a specific category
if place. hasCategory ( "restaurant" ) {
print ( "This is a restaurant" )
}
}
Use Cases
Store Locator Build a store locator to help users find nearby retail locations.
Restaurant Finder Create a restaurant discovery feature with category filters.
Delivery Zones Search geofences to determine if a location is within a delivery zone.
Competitor Analysis Find competitor locations near your stores using chain search.
Optimize Search Radius
Use the smallest radius necessary for your use case. Smaller radii return results faster.
Limit Results
Request only the number of results you need. Fewer results improve performance.
Use Specific Filters
Filter by country, category, or chain to reduce result sets and improve relevance.
Disable Geometry
For geofence searches, set includeGeometry: false if you don’t need the shapes.
Learn More
Places API Explore the complete places search API reference
Geofences API Learn about geofence search capabilities
Context Get comprehensive location context
Geocoding Convert between addresses and coordinates