Skip to content

Instantly share code, notes, and snippets.

@dariadobsai
Created February 9, 2021 22:55
Show Gist options
  • Save dariadobsai/f4c4107f5b61097e79a11df029efbd9a to your computer and use it in GitHub Desktop.
Save dariadobsai/f4c4107f5b61097e79a11df029efbd9a to your computer and use it in GitHub Desktop.
Historical map overlay with MapBox in Flutter
return Scaffold(
body: FlutterMap(
options: MapOptions(
onLongPress: addPin,
center: LatLng(47.4990, 19.0437), // Széchenyi Chain Bridge Coordinates
zoom: 12.0, // Changed zoom level from 16 to 12, to better see the whole overlay area from further distance
minZoom: 10,
plugins: [
UserLocationPlugin(),
],
),
layers: [
new TileLayerOptions(
urlTemplate:
"https://api.mapbox.com/styles/v1/{user}/{style}/tiles/256/{z}/{x}/{y}?access_token={accessToken}", // TODO: Paste your style here
// TODO: add access token here OR if you keep it in one line in `urlTemplate`, then delete `additionalOptions`.
additionalOptions: {
'accessToken': 'Your accessToken',
},
),
MarkerLayerOptions(
markers: markers,
),
userLocationOptions,
],
mapController: mapController,
),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment