PHP Classes

File: example/waypoints_load.php

Recommend this page to a friend!
  Classes of Jakub Dubec   PHP GPX Library   example/waypoints_load.php   Download  
File: example/waypoints_load.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP GPX Library
Parser and generator of GPS Exchange files
Author: By
Last change: Use php-cs-fixer to format code
Date: 6 years ago
Size: 698 bytes
 

Contents

Class file image Download
<?php
/**
 * Created 30/08/16 15:50
 * @author Jakub Dubec <jakub.dubec@gmail.com>
 */

use phpGPX\phpGPX;

require_once
'../vendor/autoload.php';

$origFile = dirname(__FILE__).'/waypoint_test.gpx';
$outFile = dirname(__FILE__).'/output_waypoint_test.gpx';
// $outFile2 = dirname(__FILE__).'/output_waypoint_test2.gpx';

$gpx = new phpGPX();
$file = $gpx->load($origFile);

phpGPX::$PRETTY_PRINT = true;
$file->save($outFile, phpGPX::XML_FORMAT);

$retcode = 0;
system("diff $origFile $outFile", $retcode);
// system("diff $origFile $outFile2", $retcode);

if ($retcode != 0) {
    throw new \
Exception("wapoint file incorrect");
} else {
    print
"wapoint test successfull\n";
}