phpGPX
phpGPX copied to clipboard
Calculate Bounds when not in original GPX file
Issue #28.
In the original phpGPX the bounds are taken from the GPX file, when it exists. However, when it does not in the file, it's worth computing it.
Getting the bounds can be useful to display a segment on a map, so we can indicate where to zoom the map (the zoom must include the for bounds). The bounds are in fact the max and min latitudes and longitudes : four values, to geographical points.
I respected the philosophy of the library, creating a BoundsCalculator and added tests. Most of the code is related to tests.
Looks pretty good @miqwit! Let me know when the PR will be ready for the review.
It is now. Checks are passing and unit tests as well. I just don't know if I need to also implement the bounds for the route. I did for the track and the segment. If you judge so, please tell me in the review, and I'll do it the same way, if this way suits you. Also I added missing tests not directly related to my code, but that I needed. This should be helpful for the project, let me know otherwise.