Download the PHP package lachlanhickey/gps-track-converter without Composer
On this page you can find all versions of the php package lachlanhickey/gps-track-converter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download lachlanhickey/gps-track-converter
More information about lachlanhickey/gps-track-converter
Files in lachlanhickey/gps-track-converter
Package gps-track-converter
Short Description A package to convert GPX, KMZ, and KML files to LineString
License MIT
Informations about the package gps-track-converter
GPS Track Converter
A PHP package for converting GPX, KMZ, and KML files to LineString format with distance calculations and route densification.
Features
- Convert GPX, KMZ, and KML files to LineString format
- Automatic file type detection
- Densify LineString to have points at regular intervals (default: 100 meters)
- Calculate total distance of the track
- Calculate distance from start for each point
- Compatible with Laravel and other PHP frameworks
Requirements
- PHP 7.4 or 8.0+
- SimpleXML extension
- ZIP extension
- Composer
Installation
Or add this to your composer.json
and run composer install
:
Usage
Basic Usage
Laravel Controller Example
Return Format
The converter returns an object with the following structure:
Supported File Formats
GPX
Extracts coordinates from:
- Track points (
trkpt
) - Route points (
rtept
) - Waypoints (
wpt
)
KML
Extracts coordinates from:
- LineString elements
- Point elements
KMZ
Automatically extracts and processes the KML file from the KMZ archive.
Densification
The package can densify routes to have points at regular intervals. This is useful for:
- Creating smoother visualizations
- Ensuring consistent data for analysis
- Generating intermediate points for animations
By default, densification creates points every 100 meters along the route.
Error Handling
The converter throws exceptions for:
- Unsupported file types
- Files with no coordinates
- Invalid file formats
- KMZ files without a KML inside
License
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.