use Location\Coordinate;
use Location\Polyline;
use Location\Formatter\Polyline\GeoJSON;
$polyline = new Polyline;
$polyline->addPoint(new Coordinate(52.5, 13.5, 1.0));
$polyline->addPoint(new Coordinate(62.5, 14.5, 2.0));
$formatter = new GeoJSON;
echo $formatter->format($polyline); // {"type":"LineString","coordinates":[[13.5,52.5,1.0],[14.5,62.5,2.0]]}
Hi,
It would be nice if this supported Alitudes, if im reading the RFC right it's an optional feature of GeoJSON for example:
https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.1
Example usage: