Comments (8)
Simplest thing to do would be to collect your points before creating the Map object, and querying the maximum and minimum latitude and longitude (max(lats_list)...). This essentially gives you a bounding box; find the width and height of this and divide those in two, and you have your centre. Not much extra code to roll for yourself, but I agree this would be useful. An option to set zoom_start to the minimum that contains all markers would be useful, too.
from folium.
I agree, and I totally did this for the first round of code, it is basically a center of mass equation for particles, but I was hoping I was missing something :)
from folium.
@digitalvapor i agree with @alpha-beta-soup, i have done this alot. The best thing to do is calculate the center of the points center set the center of the map to that.
There is a neat trick you can do, you can use shapely to calculate the bounds on the fly from the points. you need to no doubt look through them anyway/at some point...
from folium.
@birdage Thanks for the tip!
from folium.
Leaflet has a fitBounds method to accomplish this. It would be great to integrate it into folium, so that the map is redrawn to include every object or a group of them.
from folium.
@themiurgo i agree, i thought there was a method to reset the location? ive always know the location when ive created the map, but it would be helpful not having to do that, and to just call a function to do it for you!
from folium.
hello how do i find my now location
from folium.
hello how do i find my now location
you can set or get Map.location using a point (such as (lat, lon))
from folium.
Related Issues (20)
- Add example pattern for pulling JsCode snippets from external javascript files HOT 9
- Support function objects in Leaflet options. HOT 3
- HTML does not work when run on mobile. HOT 2
- Blue Lines when using TimestampedGeoJson in Folium HOT 2
- Docs not quite representative of the real "latest" version? HOT 10
- No popup when clicking on specific icons (BeautifyIcon plugin) HOT 5
- Geocoder plugin not working in Google Chrome HOT 3
- Making a tooltip stay when clicked on a marker/shape HOT 1
- Add Code of Conduct HOT 1
- Realtime Circles have non-changing radii. HOT 2
- Adding Multiple Clusters to map HOT 3
- Add support to map ruler based on configured projection HOT 3
- Request for Assistance: Multi-Marker Selection and Value Summation Display in Folium Map HOT 1
- Using HeatMapWithTime together with TimestampedGeoJson HOT 2
- Fix FitOverlays when using multiple Tilesets HOT 3
- Release v0.17.0 HOT 3
- opened_symbol option in TreeLayerControl not functioning HOT 2
- GlifyLayer not defined when using .add_to(map) HOT 3
- map.save() to support an option to export leaflet dependencies (js/css/icons) as inline base64 uris HOT 4
- Add zoomSnap parameter HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from folium.