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

Question: large dataset loading. #48

Closed osteth closed 7 years ago

osteth commented 7 years ago

Hey! I am using Flask-googleMaps for a NASA Space Apps Challenge and its been working great so far, thanks for making it! I have hit one issue I was hoping to pick your mind about and see if you have a solution.

I am tring to render over 20k +/- circles on the map to show wildfires detected by satellite. I believe I implemented FGM properly but it takes forever to load. I think this is because of the very large dataset I am loading.

Do you have any ideas for ways that I can either stream the circles in over time or something else that will work to load them?

rochacbruno commented 7 years ago

@osteth for that case I think you can generate an empty map, or with some initial circles, and then take the map object n JavaScript and a JS loop (or other technique like ws atc..) and then load maps asynchronously few at a time.

Unfortunately FGM does not have that kind of solution in Python Backend.

osteth commented 7 years ago

Thank you much for your time, that helps a lot!

osteth commented 7 years ago

I went ahead an used GeoIP to get the users coordinates and then filtered the data down using a bounding box to only show points relevant to each specific user. using FGM for the NASA Space apps challenge. thanks making it much easier for me to integrate a map into my project. can check it out if you like. https://github.com/osteth/project-firewatch

rochacbruno commented 7 years ago

@osteth nice! I'll take a look!

TIP: dont publish your private API keys to github, read it from environment variable os.environ.get("GOOGLEMAPS_KEY")

osteth commented 7 years ago

Thanks for the tip! I had to provide a working copy of the source submitted via git per the submission requirements for the local contest and couldn't figure out a way to deliver a working copy without publishing the key, but I will definitely be revoking that key and editing it to use environment variables once judging is complete.