Git Product home page Git Product logo

Comments (5)

qligier avatar qligier commented on July 20, 2024

You can use the Polyline Encoder library to decode the Polyline field. It returns the coordinates of each points.
Edit: fixed link

from stravaphp.

adriangibbons avatar adriangibbons commented on July 20, 2024

Hi @qligier, the URL in your post doesn't go anywhere. I think you mean Polyline Encoder, which I have used and is excellent.

Btw, PHP-Geometry contains a nice implementation of the Ramer–Douglas–Peucker algorithm. This gives you a similar looking line from fewer points.

Instead of decoding the polyline into lat-lngs at the server side, you could do this in the browser if you use Leaflet maps through the Leaflet.encoded plugin. Other maps have similar functionality too :)

from stravaphp.

adriangibbons avatar adriangibbons commented on July 20, 2024

@richtt a couple of issues I have bumped into with encoded polylines:

  1. If you pass the encoded polyline as part of browser URL, remember that you should limit the overall URL length to 2,000 characters - this can be an issue for encoded polylines that represent thousands of lat-lngs.
  2. Escaping of special characters in encoded polylines. I've seen at least backslashes and have used PHP's addslashes and stripslashes to remedy things, particularly if you're storing/retrieving from a database.

from stravaphp.

qligier avatar qligier commented on July 20, 2024

Yes, sorry for the link. I only knew the older google-map-polyline-encoding-tool and I've changed it just before sending the message.
The Leaflet.encoded plugin seems a very good alternative.

from stravaphp.

github-actions avatar github-actions commented on July 20, 2024

Stale issue message

from stravaphp.

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.