Mixing Flight Tickets Data with Weather Data
Hi, Codementor community!
Once upon a time I had some spare time in the weekend and decided to make some pet-project/micro-hackathon for myself. There had been no sunny weather in Moscow for a couple of months when I decided to do that. Therefore, I decided to look into it!
This is how I did it:
Step 1: I parced city coordinates from map.aviasales.ru
Step 2: I enriched it with the weather data taken from openweathermap.org.
Step 3: I plotted it on google maps as a heatmap!
Looks pretty...but, it's not very useful - color distribution was affected by the dots closeness, not by their temperature.
Step 4: I tried to plot it as colored circles where the colors were calculated as a HSL gradient.
It looks fine too, but was a bit too laggy with 3K points.
For such cases google maps have a cool feature currently is alpha-version - Fusion Tables.
- Step 5: I uploaded my data to it, plotted - super, not lags.
Fusion Tables web-interface also allows you to customize markers for data ranges. It wasn't too flexible, maybe that's because of alpha-state — there are also hacky workarounds in JS but that's enough for me now!
- Step 6: I parsed map.aviasales.ru again for the round-trip tickets prices, then filtered results slightly:
places = [place for place in Place.objects.all() if 17 <= place.weather['temp'] < 25 and place.price and place.price < 20000]
Step 7: with an ugly JS, I added it as a second layer of custom markers to the map:
Step 8: I wrapped the whole project with Docker (django, uwsgi, nginx, postgres in a single container) and rolled it out on my VPS in Netherlands!
To view the result, visit: http://catchthesummer.scythargon.ru
Time spent: less than 15 hours
Pity that aviasales.ru/calendar does not accept GET-parameters:)
Any comments are very welcomed!