-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Default Leaflet Basemap Tiles #2034
Comments
This is possible if you make use of the data attributes you can pass to the form, in particular this setting: https://github.com/flask-admin/flask-admin/blob/c8877df933ed4842e4bb8f2c8e9301c5507a42b4/flask_admin/static/admin/js/form.js#L162 Example: from flask_admin.contrib.geoa import ModelView
class CityView(ModelView):
form_widget_args = {
# field 'coordinates' is of type Geometry in my model
'coordinates': {
'data-tile-layer-url': "{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
}
} Check out all the Edit: Simply add from flask_admin.contrib.geoa import ModelView
class CityView(ModelView):
tile_layer_url = '{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
tile_layer_attribution = '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' |
Thank you @LvanWissen! I didn't realize it was configurable via subclassing the model. |
Thanks for the tip @LvanWissen |
Good point, but in terms of features it's only a naming flaw. |
We should tidy up the |
@TheoLechemia I've raised #2472 that covers this in the last commit; feel free to share your thoughts. |
Would it be possible to move toward a non-vendor lock in from Mapbox for the basemap tile provider? Per #1910 There seem to be some issues with the implementation and the MAPBOX_ID URI reference may be deprecated in their APIs.
There are also several open map tile providers that do not require an API key or other authentication mechanism. I think one of these (probably the default OpenStreetMap tiles) would make more sense for most users as a default configuration since this is a simple admin tool.
I'll write up a PR for such a change, including the documentation if no one objects.
The text was updated successfully, but these errors were encountered: