Let's assume that we have a simple GIS-like application, which presents (using Google Maps or anything similar) recorded tracks. Each track consists of points (data portions) with geo-data and additional information, like speed, altitude and similar attributes.
Basing on these additional params, I want to calculate some extra information, like average speed. What kind of data should web client receive and on which side is it the best to perform necessary calculations:
- client side: client receives (via AJAX) pure array of data (points with additional params) and all the calculations are done in Javascript in the browser,
- server side: client receives content ready to be put in the proper places, like value of average speed, and all the calculations are done on server.
Personally I was always choosing (somehow automatically)the first option, as I thought (correct me, if I'm wrong) this gives me more flexibility. But, right now, after reading some docs and pages, I can see clearly, that I may be wrong. So, what is the best practice in such situation?