Mapbox Geofencing drives operational efficiency and revenue growth

New Geofencing API simplifies managing large-scale geofences across devices.

Guest

No items found.

Guest

November 13, 2024

Mapbox Geofencing drives operational efficiency and revenue growth

New Geofencing API simplifies managing large-scale geofences across devices.

Guest

No items found.

Guest

November 13, 2024

Mapbox has launched Mapbox Geofencing for iOS and Android. The new API makes it simpler to configure and manage geofenced areas and monitor when a device enters, exits, or remains within defined boundaries. Monitored device events can then trigger personalized actions, alerts, and notifications based on a user’s real-time, real-world location.

Virtual perimeters, real results

A ‘geofence’ is the term for a virtual boundary drawn around a real-world location. Geofences can be defined individually or programmatically, such as defining an automatic radius around points or using existing boundaries data like zipcodes, census blocks, or school zones.

Developers can use geofencing in diverse ways. Geofencing can help create smart, ‘Internet of Things’ (IoT) applications that automate tasks such as turning on smart home lights when a user arrives. In marketing or advertising, geofencing can deliver personalized promotions when a customer is near a retail location. Geofences can also be used to improve user safety or enforce regulatory compliance, such as switching a hybrid vehicle to electric mode in low-emission zones.

Mapbox provides scalable geofencing, online and offline 

With Mapbox Geofencing, monitoring is handled on the client side, allowing it to function both online and offline. Applications can use location monitoring in both foreground and background modes. There are no set limits on the number of geofences managed with the API. 

Mapbox geofencing supports point-radius and complex boundary geometries that enable precise monitoring of intricate spaces, including postal code areas, property boundaries, or groups of buildings—offering greater flexibility than the traditional approaches.

Use geofencing in an outdoors application to warn of nearby fire risk or protected areas.

How to use Geofencing

Use the method geofencing.addFeature(..) to add or update a geofence:


val feature = Feature.fromJson(helsinkiAirportPolygon)
geofencing.addFeature(feature) {
    it.onError {
        Log.w(TAG, "Failed to add feature. Error: $it")
    }
    it.onValue {
        Log.d(TAG, "Added feature with ID: $it")
    }
}

Use the method geofencing.removeFeature(..) to remove a geofence:


geofencing.removeFeature("HelsinkiAirport") {
    it.onError {
        Log.w(TAG, "Failed to remove feature: $it")
    }
    it.onValue {
        Log.d(TAG, "Feature removed")
    }
}

Use the method geofencing.clearFeatures(..) to remove all geofences:


geofencing.clearFeatures {
    it.onError {
        Log.w(TAG, "Failed to clear features: $it")
    }
    it.onValue {
        Log.d(TAG, "All $it features removed.")
    }
}

The geofences added are persisted to storage. They will be available across app restarts.

These code examples are for Android. Click here for iOS information.

Configurable events 

Mapbox Geofencing sends event triggers when app users enter, exit, or remain within a geofenced area. Developers can define dwell duration in minutes for each individual geofence for more granular control.

Flexible geofence data sources

Developers can upload geofences as GeoJSON files or dynamically generate them based on on-device data or customer inputs. It is also possible to use existing data products like Mapbox Boundaries or generate travel-time based geometries with the Mapbox Isochrone API.

Using geofences with marketing tools

Geofence events can be sent from the client application to centralized campaign management tools, allowing developers to build audiences, create segments, and run promotional campaigns more effectively based on collected data.

Use geofencing to serve promotional campaigns or rewards to drive in-store sales

Minimize development effort

Android and iOS geofencing services both have platform-specific implementation differences. Third-party geofencing products often need to be integrated into a wider platform that offers more robust maps, search, and navigation solutions. With Mapbox Geofencing, customers unite their geofencing solution with the wider Mapbox platform. This saves development time and effort by skipping platform specific implementations and complicated third-party integrations.

Use geofencing to help parents monitor when children have arrived to or left from school

Get started with Mapbox Geofencing

Mapbox Geofencing is currently in beta. View the release notes for iOS and Android to get started. Mapbox has included an example for building a geofence surrounding a user’s location with a dynamic highlight color that changes to indicate specific geofence events (iOS, Android). There is also an example for building a tappable map interface where users can generate an isochrone-based geometry that can be added as a custom geofence (iOS, Android).

Heading 1

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Heading 2

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Heading 3

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Heading 4

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Heading 5

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Heading 6

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

response = requests.get(

  "https://api.mapbox.com/v4/mapbox.temperature-raster-tileset/tilequery/40,-105.json",

    params={

        "layers": "temperature,wind_speed",

        "bands": "1708304400,1708311600",

    },

Optional caption
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque euismod maximus porta. Pellentesque vitae augue elit. Nam semper eros leo, nec hendrerit nunc aliquet quis. Morbi ac sapien tortor. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Curabitur porta imperdiet lorem, ut aliquet orci pellentesque quis. Donec magna augue, molestie aliquam enim eu, auctor feugiat metus."

Ordered list

  1. Item 1
  2. Item 2
  3. Item 3

Unordered list

  • Item A
  • Item B
  • Item C

Text link

Bold text

Emphasis

Superscript

Subscript

No items found.
No items found.

Related articles