CristianLara / canoe-flights

Canoe - Inexpensive flight and location explorer
http://canoesave.me
MIT License
2 stars 0 forks source link

Add color to flights, improve lag #21

Closed CristianLara closed 6 years ago

CristianLara commented 6 years ago
screen shot 2018-02-17 at 5 15 23 pm

Huge update! So after investigating, it looked like we were going about the whole mapbox thing in a very suboptimal way. Instead of uploading data about airports to mapbox studio and filtering that during runtime using the flights we receive from the api, now we dynamically set the data at runtime and update it according to the api response.

Why is this necessary? Two reasons:

  1. Part of what was slowing us down before was having to loop through the entire api response and performing a variety of checks on the data to filter it. Now we just put the entire response into the map data and leverage the mapbox filter feature to do the work for us. Changing the filters is now super smooth and responsive!
  2. Since we were uploading the data to mapbox studio beforehand, it meant that we couldn't dynamically change the styles (because the data doesn't have flight price info). Now we construct our own custom geojson with whatever info we want in it.

The only down side to this is that we can't use mapbox studio anymore to change styles, but we have a lot more control this way.