Using OpenStreetMap (direct)
Last updated
Was this helpful?
Last updated
Was this helpful?
flutter_map wants to help keep map data available for everyone. One of the largest sources of this data is OpenStreetMap. OpenStreetMap data powers the majority of non-proprietary maps - from actual map tiles/images to navigation data - in existence today. The data itself is free for everyone under the .
The OpenStreetMap Foundation run OpenStreetMap as a not-for-profit. They also provide a public tile server at , which is run on donations and volunteering time. This server is used throughout this documentation for code examples, and in our demo app.
flutter_map can be setup to conform to these requirements - but it may not conform by default.
The OpenStreetMap public tile server is without cost (for users), but, "without cost" ≠ "without restriction" ≠ "open".
This reduces the strain on tile servers, improves compliance with their policies, and has numerous other benefits for your app!
TileLayer
is loaded using one of the OpenStreetMap tile servers (in debug mode)Additionally, where an appropriate User-Agent header (which identifies your app to the server) is not set - for example, through TileLayer.userAgentPackageName
, or directly through the tile provider's HTTP headers configuration - a warning will appear in console (in debug mode), advising you to set a UA.
The OpenStreetMap tile server is NOT free to use by everyone.
The top 7 user-agents are shown below, in order (with traffic rounded to the nearest whole tile). ('Missed' tiles are those which required fresh rendering, and are more expensive than most other requests.)
flutter_map (*) This represents the of FM users on non-web platforms.
1610
53
Mozilla/5.0 QGIS/*
1155
358
Mozilla/5.0 ...
476
33
com.facebook.katana
263
3
Dart/* (dart:io) This represents FM users on older versions (not on web) & other Flutter mapping libraries not using FM (not on web).
182
17
Mozilla/5.0 ...
175
6
Mozilla/5.0 ...
171
14
And looking in more detail at the User-Agent's making up the primary 'flutter_map (*)' agent, on 2025/05/28:
flutter_map (unknown)
This represents users failing to use TileLayer.userAgentPackageName
.
99,258,371
flutter_map (com.example.app) This is likely a combination of users copy-pasting from the docs & personal projects.
7,808,777
flutter_map (dev.fleaflet.flutter_map.example) This is likely a combination of users using the Demo app (primarily), and users copy-pasting from the example app.
6,402,576
Next largest User-Agent is an adequately identified app
3,953,312
We are extremely proud to see flutter_map being used so much! At the same time, we are aware that there are many users placing a potential strain on OpenStreetMap, which we want to minimize:
We do not want to discourage legitimate use-cases from using the OpenStreetMap tile servers
We want to help users who may be accidentally or unknowingly breaking the OpenStreetMap usage policies adjust their project so they can continue to benefit from cost-free tiles
However, we do wish to discourage illegitimate use-cases or users who are intentionally breaking the OpenStreetMap usage policies
Therefore, we are introducing measures to force users to read the OpenStreetMap Tile Usage Policy before allowing them to use the servers in release builds:
This is easy for legitimate users who have already read the policy and follow it
It helps users accidentally breaking the policies to see why it's so important to follow them, and what they can do to fix any issues
It adds friction for users intentionally breaking the policies
Ultimately however, it is your own responsibility to comply with any appropriate restrictions and requirements set by your chosen tile server/provider. Always read their Terms of Service. Failure to do so may lead to any punishment, at the tile server's discretion.
This policy is completely unrelated to the OpenStreetMap Foundation, and was the sole collective decision of the maintainers.
Our docs list multiple alternatives, many of which have free tiers suitable for hobbyists, affordable pricing for commercial usage, and one which is extremely flexible.
Most of these are built off the same data, so the actual information contained within the map won't change (although a change in style may not show some data).
If you're a commercial user and want the best balance of flexibility and affordability, consider setting up your own private tile server! In any case, the OpenStreetMap tile server doesn't offer uptime guarantees, which may be important to your business.
If you still want to use OpenStreetMap, you must read the policy and comply with its restrictions and requirements. It also contains some background info as to why this is important.
To note:
Should any users or patterns of usage nevertheless cause problems to the service, access may still be blocked without prior notice.
If your project uses a very large number of tiles, even if it would otherwise meet the requirements, consider switching to a different server.
Also note all the other requirements, which may require you to make adjustments to your project...
Check the OSM policy for all the adjustments you might need to make. Here's some common ones:
Enable conforming caching
v8.2.0 introduces automatically enabled Caching! This is designed to meet the caching requirements of the usage policy. Upgrade to v8.2.0 to enable this functionality.
Add sufficient attribution
The RichAttributionWidget
or SimpleAttributionWidget
can both be used to setup attribution which looks great, is unintrusive, and is conforming - provided you add the necessary sources. See Attribution Layer for more info and a simple code snippet you can add to meet the attribution requirement.
You can also add attribution in any other way that meets the requirements.
Set a more specific user-agent to identify your client
If you're appropriately using the servers, you can disable the console warnings. This will also disable any future blocks.
To do this, set the flutter.flutter_map.unblockOSM environment variable when building/running/compiling. Use the dart-define
flag to do this.
To evidence that you've read and understood the tile policy, you should set it to the exact string (excluding any leading or trailing whitespace, including all other punctuation) following the phrase from the policy:
OpenStreetMap data is free for everyone to use. _____
For example, to run the project:
You can also add this to your IDE's configuration to automatically pass this argument when running from your IDE.
If you've got a question or comment regarding this new policy, or if you think we've missed something, please reach out to us.
The best way to do this is on the dedicated GitHub issue, or on the Discord server.
on 2025/06/09 shows flutter_map as the largest single user-agent in terms of the average number of tile requests made per second over the day. Whilst it is true that there are multiple user agents smaller who make up an overall much larger portion of total usage - for example, leaflet.js's usage is split across the browsers' user-agents, as is flutter_map usage on the web - the usage of flutter_map cannot be ignored.
There's also other options to implement to meet the requirements, and go beyond the capabilities of the built-in caching.
flutter_map provides its own user-agent on native platforms, but this isn't enough to meet the requirements. You should set TileLayer.userAgentPackageName
: see the for the TileLayer
.