-
-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Statistics - get Bounds of the GPX Routes #28
Comments
Hi, |
thanks, I am new to this package but it looks very good. On a side issue I am having trouble with my require statements as I seem to need them in a particular order. Is there an easy way to load these classes, I am running within Joomla which has its own autoload classes |
This feature is nice to have in a 2.x release. The bounding box will be created for each route, segment and track. |
Hello. +1 here. Any progress on this? Would you need help to implement it? // Find the bounds of the trace, for a later zoom in mapbox
$geojsonArray = json_decode($geoJson, true);
// Initialize variables to store the most NW and SE points
$north = -PHP_FLOAT_MAX; // Longest lat
$east = -PHP_FLOAT_MAX; // Longest lon
$south = PHP_FLOAT_MAX; // Smallest lat
$west = PHP_FLOAT_MAX; // Smallest lon
// Iterate through each feature and its coordinates
foreach ($geojsonArray['features'] as $feature) {
foreach ($feature['geometry']['coordinates'] as $lineString) {
foreach ($lineString as $point) {
$lng = $point[0];
$lat = $point[1];
// Update northWest and southEast points if needed
if ($lat > $north) {$north = $lat;}
if ($lng > $east) {$east = $lng;}
if ($lat < $south) {$south = $lat;}
if ($lng < $west) {$west = $lng;}
}
}
} |
Yeah, I am sorry. I wish I had much more time for this project (think about it a lot). I don't want to make false promises about the deadline. If you offer a PR I will take a look. For the next two months, there is no way I will implement this. I am sorry. Thanks for your patience. |
I updated my algorithm, as it had a problem. I will be happy to contribute to your library, I'll try to find time. |
I worked on the bounds topic this morning, before seeing there is some work done in |
@miqwit I will gladly wait for the PR ;) Sorry, but I am not right know a fan of direct access to the repository without PR process. I hope you are understand. |
Yes I do. My problem is that I can't create a PR at all. I get this error: "Pull request creation failed. Validation failed: must be a collaborator". |
@miqwit how did you created the feature branch? Did you created a fork? My proposed solution:
|
OK, so I reviewed the However, when the element is not in the GPX (I am in this situation) it can be useful to compute it ; only when it's not there already. In this case my code will be useful. I can go in this direction if you agree it's a good way. First, can you tell me the state of the develop branch? Should I fork from there, or should I fork from |
Yeah, I agree that we should compute it. This feature should be configurable. Currently, the state of the |
But I have to admit that |
Yes, I see. What I can suggest is that I work on another branch, and I take from |
Yeah, I guess that makes sense. Thank you very much. If you have any questions feel free to ask ;) |
A useful new feature would be to be able to obtain the bounds of points in the GPX file.
So you would retrieve the min/max Longitude and Latitude.
I am looking at this package to process walking routes to get overall stats. The bounds would allow me to display all my routes on a single map. Each walk would have an icon showing stats and a link to display the actual walk.
I have only just found this project but it looks good.
The text was updated successfully, but these errors were encountered: