New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
append point to linstring #88
Comments
you would probably nee to get the last point of your track, use that and the other option is to serialize to string, append the point to the string and deserialize from string |
Thank you for answer. $trackFile = 'track.gpx';
$loc = array(42.34,13.23); //new POINT
$locGeo = geoPHP::load('POINT('.implode(' ',$loc).')','wkt');
$track = geoPHP::load(file_get_contents($trackFile),'gpx');
$trackAr = $track->asArray();
if( $locGeo->equals($track->endPoint()) )
die('this last point just exists');
else
$trackAr[]= $loc;
$trackOut = array();
foreach($trackAr as $v)
$trackOut[]= new Point($v[0],$v[1]);
$trackOut = new LineString($trackOut);
$out = $trackOut->out('gpx');
file_put_contents($trackFile, $out); |
maybe a new method: addPoint inside LineString class could be useful |
hi
how can I append new point at end of gpx track?
The text was updated successfully, but these errors were encountered: