GithubHelp home page GithubHelp logo

Comments (8)

alpha-beta-soup avatar alpha-beta-soup commented on July 30, 2024

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.

dreamalligator avatar dreamalligator commented on July 30, 2024

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.

birdage avatar birdage commented on July 30, 2024

@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.

dreamalligator avatar dreamalligator commented on July 30, 2024

@birdage Thanks for the tip!

from folium.

themiurgo avatar themiurgo commented on July 30, 2024

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.

birdage avatar birdage commented on July 30, 2024

@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.

Cahitisleyen avatar Cahitisleyen commented on July 30, 2024

hello how do i find my now location

from folium.

sunshinejnjn avatar sunshinejnjn commented on July 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.