Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,51 @@ Widget build(BuildContext context) {
}
```

### Mapbox provider

To configure [Mapbox](https://www.mapbox.com/), you should create your
[access token](https://docs.mapbox.com/help/getting-started/access-tokens/).

You can use tiles provided and hosted by Mapbox. The list can be found
[here](https://docs.mapbox.com/api/maps/styles/#mapbox-styles).

```dart
Widget build(BuildContext context) {
return new FlutterMap(
options: new MapOptions(
center: new LatLng(51.5, -0.09),
zoom: 13.0,
),
layers: [
new TileLayerOptions(
urlTemplate: "https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/"
"{z}/{x}/{y}?access_token=$accessToken",
),
new MarkerLayerOptions(
markers: [
new Marker(
width: 80.0,
height: 80.0,
point: new LatLng(51.5, -0.09),
builder: (ctx) =>
new Container(
child: new FlutterLogo(),
),
),
],
),
],
);
}
```

Make sure `accessToken` is properly encoded as valid URI component.
If you use Mapbox Studio with your own tile sets, just use URL like this:
`https://api.mapbox.com/styles/v1/:accountName/:tileSetId/tiles/256/{z}/{x}/{y}@2x`
where `:accountName` is your user account name and `:tileSetId` is the
ID of your tile set, more information is
[here](https://docs.mapbox.com/help/glossary/style-url/).

### Widget Layers

__Use the new way to create layers__ (compatible with previous version)
Expand Down