flask-extensions / Flask-GoogleMaps

Easy way to add GoogleMaps to Flask applications. maintainer: @getcake
https://flask-googlemaps.com
MIT License
647 stars 196 forks source link

Add toggle for map.fitBounds() - closes issue #55 #56

Closed mattdaviscodes closed 7 years ago

mattdaviscodes commented 7 years ago

Allow users to easily fit all markers within view on page load

Without bounds

@app.route('/map-unbounded/')
def map_unbounded():
"""Create map with markers out of bounds."""
    locations = []    # long list of coordinates
    map = Map(
        lat=locations[0].latitude,
        lng=locations[0].longitude,
        markers=[(loc.latitude, loc.longitude) for loc in locations]
    )
    return render_template('map.html', map=map)

image

With bounds

@app.route('/map-bounded/')
def map_bounded():
"""Create map with all markers within bounds."""
    locations = []    # long list of coordinates
    map = Map(
        lat=locations[0].latitude,
        lng=locations[0].longitude,
        markers=[(loc.latitude, loc.longitude) for loc in locations],
        fit_markers_to_bounds = True
    )
    return render_template('map.html', map=map)

image

rochacbruno commented 7 years ago

Lets include those images and how to on readme.md?

mattdaviscodes commented 7 years ago

This is so cool! My first PR. 😄

rochacbruno commented 7 years ago

nice! @mattdavis1121 can you do the https://github.com/rochacbruno/Flask-GoogleMaps/issues/57 ? it is easy just include the info from here in README.md file (including those screenshot) and also maybe include in the example app

mattdaviscodes commented 7 years ago

See #58. Added to the README, but I won't have time to do the example app. Hope that's okay.

Will this trigger a new release? I'm using this package at work, and I'd like to have the new code available in my requirements file.

Thanks!

rochacbruno commented 7 years ago

@mattdavis1121 I'll finish reviewing the PRs and then release by the weekend.

mattdaviscodes commented 7 years ago

Great! Thanks, Bruno.

mattdaviscodes commented 7 years ago

@rochacbruno Any update on the release?

rochacbruno commented 7 years ago

@mattdavis1121 released https://pypi.org/project/Flask-GoogleMaps/

mattdaviscodes commented 7 years ago

@rochacbruno Great! Just installed and everything's working well. Thanks, man.

Any idea why the package doesn't show up in the results of pip freeze? Can't figure it out. I just wrote a SO question about it. https://stackoverflow.com/questions/46105730/why-doesnt-pip-installed-package-show-up-in-pip-freeze