Coder Social home page Coder Social logo

Comments (15)

miqwit avatar miqwit commented on July 20, 2024 1

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.

miqwit avatar miqwit commented on July 20, 2024 1

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.

Sibyx avatar Sibyx commented on July 20, 2024 1

@miqwit how did you created the feature branch? Did you created a fork? My proposed solution:

  1. Fork phpGPX
  2. Add you changes to the fork
  3. Create PR (hopefully without any problems)

from phpgpx.

Sibyx avatar Sibyx commented on July 20, 2024

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.

ramblerswebs avatar ramblerswebs commented on July 20, 2024

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.

Sibyx avatar Sibyx commented on July 20, 2024

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.

Sibyx avatar Sibyx commented on July 20, 2024

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.

miqwit avatar miqwit commented on July 20, 2024

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.

Sibyx avatar Sibyx commented on July 20, 2024

@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.

miqwit avatar miqwit commented on July 20, 2024

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.

miqwit avatar miqwit commented on July 20, 2024

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.

Sibyx avatar Sibyx commented on July 20, 2024

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.

Sibyx avatar Sibyx commented on July 20, 2024

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.

miqwit avatar miqwit commented on July 20, 2024

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.

Sibyx avatar Sibyx commented on July 20, 2024

Yeah, I guess that makes sense. Thank you very much. If you have any questions feel free to ask ;)

from phpgpx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.