-
-
Notifications
You must be signed in to change notification settings - Fork 860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
it gives me blank... no map is showing.... i tried a lot of tutorials ...so tired and depressed #206
Comments
this is the console registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection) |
Bit confused, haven't you just commented out the URL for the tiles & subdomain and included an interactive webpage that wouldn't work (I can't tell properly from where I am), but you would need to include a tile serving URL ? |
@Muhammad-saafan you have to use the correct URL on the urlTemplate like this:
|
layers: [
new TileLayerOptions(
urlTemplate: "https://api.mapbox.com/styles/v1/{id}/tiles/512/{z}/{x}/{y}@2x?access_token={accessToken}",
additionalOptions: {
'accessToken': 'pk.eyJ1IjoibXVoYW1tYWQ5NCIsImEiOiJjanF3N3o2ZzUwb2R1NDJudzJnY3VkMXcxIn0.jo3ONUsCTUYRv7YAZrehlQ',
'id': 'mapbox.mapbox-streets-v8',
},
), this will work well, i took time to find good uri which work with leaflet too |
@stafyniaksacha thanks for helping out. @Muhammad-saafan did this fix your issue? It sounds like we need to add a better explanation for |
Same issue, any solutions? |
@thanooshan is your url template correct? |
@johnpryan This is my layers code. Am I missing something? |
@johnpryan @stafyniaksacha Map is working. We have to use CARTO url. Previously I used WMTS url. |
For anyone else stuck I found a url that works Here an example: Replace my username acidhue and the key after it with your own.
|
thanks @OllyDixon! |
Fixed by getting a url from Mapbox studio > Share button > Third party tab > CARTO option in dropdown with the following code: Container(
width: 500,
height: 500,
child: FlutterMap(
options: MapOptions(
center: LatLng(51.5, -0.09),
zoom: 13.0,
),
layers: [
TileLayerOptions(
urlTemplate: "https://api.mapbox.com/styles/v1/<username>/ck15ozlow33tj1cph5cpt2y79/tiles/256/{z}/{x}/{y}@2x?access_token=<token>",
),
MarkerLayerOptions(
markers: [
Marker(
width: 80.0,
height: 80.0,
point: LatLng(51.5, -0.09),
builder: (ctx) =>
Container(
child: FlutterLogo(),
),
),
],
),
],
),
), There are a few parts here that I would really love to see reflected in the docs for this plugin. First off, I had to figure out to use a container to size things, secondly, the URL and how to get it... |
hello i have same issue and try lot with codes which users here recommended . also with Mapbox studio i use this code but still receive null gray page import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong/latlong.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
home: new MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => new _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(title: new Text('Leaflet Maps')),
body: new FlutterMap(
options: new MapOptions(
center: new LatLng(35.22, -101.83), minZoom: 5.0),
layers: [
new TileLayerOptions(
urlTemplate:
"https://api.mapbox.com/styles/v1/rajayogan/cjl1bndoi2na42sp2pfh2483p/tiles/256/{z}/{x}/{y}@2x?access_token=pk.eyJ1IjoicmFqYXlvZ2FuIiwiYSI6ImNqNW1nOXhtMTNndXkyeG5xbDZiNzZmaGcifQ.S5sdpVrOr2pa5oRqvWDMGA",
additionalOptions: {
'accessToken':
'pk.eyJ1IjoicmFqYXlvZ2FuIiwiYSI6ImNqNW1nOXhtMTNndXkyeG5xbDZiNzZmaGcifQ.S5sdpVrOr2pa5oRqvWDMGA',
'id': 'mapbox.mapbox-streets-v7'
}),
new MarkerLayerOptions(markers: [
new Marker(
width: 45.0,
height: 45.0,
point: new LatLng(35.215, -101.825),
builder: (context) => new Container(
child: IconButton(
icon: Icon(Icons.location_on),
color: Colors.blue,
iconSize: 45.0,
onPressed: () {
print('Marker tapped');
},
),
))
])
]));
}
}``` |
Not sure if that's the correct token, but it says invalid token... |
layers: [
new TileLayerOptions(
urlTemplate:
// "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
// subdomains: ['a', 'b', 'c']),
"https://api.mapbox.com/styles/v1/muhammad94/cjqwfwdpr1o452sqzoy3b74ua.html?fresh=true&title=true&access_token=pk.eyJ1IjoibXVoYW1tYWQ5NCIsImEiOiJjanF3N3o2ZzUwb2R1NDJudzJnY3VkMXcxIn0.jo3ONUsCTUYRv7YAZrehlQ#9.0/37.780000/-122.424100/0",
additionalOptions: {
'accessToken':
'<pk.eyJ1IjoibXVoYW1tYWQ5NCIsImEiOiJjanF3N3o2ZzUwb2R1NDJudzJnY3VkMXcxIn0.jo3ONUsCTUYRv7YAZrehlQ>',
'id': 'mapbox.mapbox-streets-v8',
},
this is my code when using leaflet it works and when using mapbox it give me blank page
The text was updated successfully, but these errors were encountered: