mapbox_api 0.1.1 mapbox_api: ^0.1.1 copied to clipboard
Unofficial Mapbox Dart SDK that follow official Mapbox documentation.
mapbox-api #
This package aim to :
- be a Dart SDK for Mapbox API with only http as dependency
- follow the official documentation
🚧 WIP Notice #
This is a work in progress, feel free open an issue for questions and remarks. (PR are welcome :))
Examples #
See examples/examples.dart
import 'package:mapbox_api/mapbox_api.dart';
MapboxApi mapbox = MapboxApi(
accessToken: '<Mapbox API token>',
);
Get your API token on mapbox.com
Request directions services
DirectionsApiResponse response = await mapbox.directions.request(
profile: NavigationProfile.DRIVING_TRAFFIC,
overview: NavigationOverview.FULL,
geometries: NavigationGeometries.POLYLINE6,
steps: true,
coordinates: <List<double>>[
<double>[
37.786060, // latitude
-122.246225, // longitude
],
<double>[
37.785939, // latitude
-122.194292, // longitude
],
],
);
if (response.error == null) {
// response.routes ...
// response.waypoints ...
}
Request map matching services
MapMatchingApiResponse response = await mapbox.mapMatching.request(
profile: NavigationProfile.WALKING,
geometries: NavigationGeometries.GEOJSON,
tidy: true,
coordinates: <List<double>>[
<double>[
37.786060, // latitude
-122.246225, // longitude
],
<double>[
37.785939, // latitude
-122.194292, // longitude
],
],
);
if (response.error == null) {
// response.matchings ...
// response.tracepoints ...
}
Supported API #
Maps #
Service | Implemented |
---|---|
Vector Tiles | ✖️ |
Taster Tiles | ✖️ |
Static Images | ✖️ |
Static Tiles | ✖️ |
Styles | ✖️ |
Tilequery | ✖️ |
Uploads | ✖️ |
Mapbox Tiling Service | ✖️ |
Datasets | ✖️ |
Fonts | ✖️ |
Navigation #
Service | Implemented |
---|---|
Directions | ✅ |
Isochrone | ✅ |
Map Matching | ✅ |
Matrix | ✅ |
Optimization | ✅ |
Search #
Service | Implemented |
---|---|
Geocoding | ✖️ |
If you are looking for geocoding, take a look at ketanchoyal/mapbox_search
Accounts #
Service | Implemented |
---|---|
Tokens | ✖️ |
Related Packages #
This SDK will work perfectly with flutter-mapbox-gl to display retrieved data (will work with any other package too). You may also need polyline package to convert polylines strings to coordinates.