-
Notifications
You must be signed in to change notification settings - Fork 28
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
Always got HttpException 400 #61
Comments
Can you share the code for the whole function? The one that generates the address. |
late final _controller = MapController(
location: LatLng(
Angle.degree(initialCameraPosition.target.latitude),
Angle.degree(initialCameraPosition.target.longitude),
),
);
late final _tilesUrl = 'https://tile.openstreetmap.org/{z}/{x}/{y}.png';
@override
Widget build(BuildContext context, WidgetRef ref) {
return MapLayout(
controller: _controller,
builder: (context, transformer) {
return TileLayer(
builder: (context, x, y, z) {
final tilesInZoom = pow(2.0, z).floor();
while (x < 0) {
x += tilesInZoom;
}
while (y < 0) {
y += tilesInZoom;
}
x %= tilesInZoom;
y %= tilesInZoom;
return CachedNetworkImage(
imageUrl: _tilesUrl,
httpHeaders: {'User-Agent': packageInfo.packageName},
fit: BoxFit.cover,
);
},
);
},
);
} |
Can you try another title provider? Did you check the tile addresses in your browser? |
I use exactly same url on flutter map, it works. |
Can you ditch This is a problem with your configuration or a problem with |
Ah the problem is with your url.
The url can't be a fixed string. It needs to be interpolated with |
Osm url
https://tile.openstreetmap.org/{z}/{x}/{y}.png
returns error likeHttpException: Invalid statusCode: 400, uri = https://tile.openstreetmap.org/%7Bz%7D/%7Bx%7D/%7By%7D.png
. Same result with mapbox.The text was updated successfully, but these errors were encountered: