Coder Social home page Coder Social logo

Comments (2)

eusonlito avatar eusonlito commented on July 20, 2024

With the AbstractExtension update I get this XML (extensions is empty):

<?xml version="1.0" encoding="UTF-8"?>
<gpx xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1" creator="phpGPX/1.2.1" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
  <metadata>
    <time>2023-04-25T18:11:34+00:00</time>
  </metadata>
  <trk>
    <name>2023-04-25 20:11:34 - 2023-04-25 20:25:08</name>
    <trkseg>
      <trkpt lat="42.3591" lon="-7.86783">
        <time>2023-04-25T18:11:34+00:00</time>
        <extensions/>
      </trkpt>
      <trkpt lat="42.3588" lon="-7.86811">
        <time>2023-04-25T18:11:54+00:00</time>
        <extensions/>
      </trkpt>
      <trkpt lat="42.35839" lon="-7.86861">
        <time>2023-04-25T18:12:04+00:00</time>
        <extensions/>
      </trkpt>
      <trkpt lat="42.35818" lon="-7.86904">
        <time>2023-04-25T18:12:14+00:00</time>
        <extensions/>
      </trkpt>
      <trkpt lat="42.35774" lon="-7.86901">
        <time>2023-04-25T18:12:24+00:00</time>
        <extensions/>
      </trkpt>
      <trkpt lat="42.35754" lon="-7.86892">
        <time>2023-04-25T18:12:34+00:00</time>
        <extensions/>
      </trkpt>
      <trkpt lat="42.35714" lon="-7.8685">
        <time>2023-04-25T18:12:43+00:00</time>
        <extensions/>
      </trkpt>

from phpgpx.

eusonlito avatar eusonlito commented on July 20, 2024

Ok, I found the correct code :)

I couldn't find any documentation on how to use Extensions :(

/**
 * @param \App\Domains\Position\Model\Position $position
 *
 * @return \phpGPX\Models\Point
 */
protected function point(PositionModel $position): Point
{
    $point = new Point(Point::TRACKPOINT);
    $point->latitude = $position->latitude;
    $point->longitude = $position->longitude;
    $point->time = $position->date_at;

    $trackPointExtension = new TrackPointExtension();
    $trackPointExtension->speed = $position->speed;
    $trackPointExtension->course = $position->direction;

    $extension = new Extensions();
    $extension->trackPointExtension = $trackPointExtension;

    $point->extensions = $extension;

    return $point;
}

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.