Would be good to divide this function up into smaller functions, to make it easier to understand how the function works. Probably split it into a function, that validates the user data, function, that makes the request for the data, function, that works with the received json response to make it usable for other functions, a function that draws the markers and polylines on the map. And just call them all from the filter function.
Mostly done, don't have a large filter function anymore, it is divided into smaller functions. Can maybe be divided into even smaller functions, but main idea is complete - no more 100+ line filter function.
Would be good to divide this function up into smaller functions, to make it easier to understand how the function works. Probably split it into a function, that validates the user data, function, that makes the request for the data, function, that works with the received json response to make it usable for other functions, a function that draws the markers and polylines on the map. And just call them all from the filter function.