Question: add bounds to TileLayers?
See original GitHub issuepsuedo code example
MIN_ZOOM = 8
MIN_LEVEL = 12
MAX_LEVEL = 17
map = folium.Map(location=center, zoom_start=14)
for i in range(0, 5):
map.add_tile_layer(max_zoom=MAX_LEVEL, min_zoom=MIN_ZOOM, tiles=styles[i])
...
for track in gpx_tracks:
fg = folium.FeatureGroup(name=track.name)
url = 'http://0.0.0.0:5000/smarttile/{customname}'.format(customname=make_word(track.name))
tl = folium.TileLayer(
tiles=url + '/{z}/{x}/{y}.png',
attr='myself',
min_zoom=MIN_LEVEL, max_zoom=MAX_LEVEL,
name=name,
)
fg.add_child(tl)
map.add_child(fg)
Problem description
This is a question. (And I am quite new at this. )
I am reading several gpx tracks (traces from hikes) and wants to generate tiles for these tracks on demand, and display it/them on a map.
Since a track has a bounding box, I would like to only request tiles for the inside of that bounding box, and I would like to be able to display several (mostly) disjoint tracks/areas.
Below is pseudo code of what I am trying to do, I tried to add something like this: “folium.FitBounds([track.corner1, track.corner2])” but I did not get it to work like expected.
Is it possible to do what I want to do?
Expected Output
Output of folium.__version__
$ python3
Python 3.6.5 (default, Apr 1 2018, 05:46:30)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import folium
>>> folium.__version__
'0.6.0'
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
XY bounds for L.tileLayer in CRS.Simple - GIS Stack Exchange
But I don't know how to do L.tileLayer with this bounds (coordinates) [1468.9700 ... I trying to resolve my problem, but it don't...
Read more >Leaflet WMS Tile Layer bounds set - geoserver - Stack Overflow
I want to limit my wms tile layers with a region. I saw a parameter in the WMSTileLayer bounds, however it can't be...
Read more >TileLayer - deck.gl
The TileLayer is a composite layer that makes it possible to visualize very large datasets ... Each tile has a pre-defined bounding box...
Read more >Constrain bounds of TileLayer · Issue #888 - GitHub
Would it be possible to add a property to the TileLayer that will constrain its bounds? The lack of constraint poses a problem...
Read more >ol/layer/Tile~TileLayer - OpenLayers
The bounding extent for layer rendering. The layer will not be rendered outside of this extent. zIndex, number | undefined. The z-index for...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Well, doing the trivial change of adding the line with bounds in the javascript here below seemed to do the trick.
Is the example below here clear enough?
The same thing in unified diff format (different coordinates since they belong to different tracks):
I don’t think I am up to speed so I can do the changes in folium by myself, but I would be very interested in testing a poll request for this.
That is a start. If you figure that out we can probably wrap it into
folium
.