Comments (15)
Hello. +1 here. Any progress on this? Would you need help to implement it?
I have this code in PHP in my project (reading a geojson file), which does the trick. It would be nice to have in this library.
// 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;}
}
}
}
from phpgpx.
I updated my algorithm, as it had a problem. I will be happy to contribute to your library, I'll try to find time.
On the other hand, it would be handy to export the track as an actual GeoJSON, rather than a proprietary JSON. I create another issue for that.
from phpgpx.
@miqwit how did you created the feature branch? Did you created a fork? My proposed solution:
- Fork phpGPX
- Add you changes to the fork
- Create PR (hopefully without any problems)
from phpgpx.
Hi,
auto-generation of the Bounds object should be a nice feature.
I can start with the implementation next week, or feel free to offer a PR.
from phpgpx.
thanks, I am new to this package but it looks very good.
It would be great to have the above facility.
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
from phpgpx.
This feature is nice to have in a 2.x release. The bounding box will be created for each route, segment and track.
from phpgpx.
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.
from phpgpx.
I worked on the bounds topic this morning, before seeing there is some work done in develop
:( Still, I'd like to submit my code in a PR for a review, even if it's discarded at a later stage. Can you add me as a collaborator to the project? (I can't create a PR right now).
from phpgpx.
@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.
from phpgpx.
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".
from phpgpx.
OK, so I reviewed the develop
branch, and realised that it's taking the bounds from the GPX format, as described in the specification: https://www.topografix.com/GPX/1/1/#type_boundsType.
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 master
and include both my code and your code?
from phpgpx.
Yeah, I agree that we should compute it. This feature should be configurable.
Currently, the state of the develop
branch is according to the Project Roadmap in the #67 discussion. I think that we should focus on the 2.x
release.
from phpgpx.
But I have to admit that develop
is right know not in the ideal state. There is still plenty of work regarding to the typing for example. I am already started with removing of the Summarizable interface and creating new configuration object.
from phpgpx.
Yes, I see. What I can suggest is that I work on another branch, and I take from develop
the work on the bounds, which is useful ; and in integrate my code (which respect the old-types format), what do you think? I created classes and even tests the way it is currently done (in master
).
from phpgpx.
Yeah, I guess that makes sense. Thank you very much. If you have any questions feel free to ask ;)
from phpgpx.
Related Issues (20)
- Error when last trk point does not have a time set HOT 1
- Cumulative elevation loss HOT 2
- Implementing way point and creation time extensions HOT 1
- use custom trackpoint extension (in this case: Bad-Elf)? HOT 8
- Elevation string float becomes null in getJSON() call HOT 3
- cumulativeElevationLoss is missing in stats HOT 1
- Tag a new version HOT 3
- Error when $person->links is null HOT 2
- Should be 1.1.0 HOT 1
- startedAt and finishedAt values are not present if the first (or last) point is without timestamp
- Error installing with composer HOT 2
- cumulativeElevationGain and cumulativeElevationLoss not correct when missing parts of track with gps problem? HOT 10
- Class Error (Fatal error: Uncaught Error: Class "phpGPX\phpGPX" not found in) HOT 3
- [PR advise] Add coordinates for remarqued statistic points HOT 2
- phpGPX\Parsers\ExtensionParser::toXML(): Argument #1 ($extensions) must be of type phpGPX\Models\Extensions HOT 2
- Waypoints at the root of the gpx tag HOT 5
- Middlewares
- Removal of Summarizable and toArray HOT 2
- Minimum altitude is not necessarily the first point HOT 3
- Add version GPX
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phpgpx.