All Projects → tyrasd → Togpx

tyrasd / Togpx

Licence: mit
convert geojson to gpx

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Togpx

Vector Datasource
Tilezen vector tile service - OpenStreetMap data in several formats
Stars: ✭ 427 (+848.89%)
Mutual labels:  geojson
Countries
World countries in JSON, CSV, XML and Yaml. Any help is welcome!
Stars: ✭ 5,379 (+11853.33%)
Mutual labels:  geojson
Osm2geojson
Convert OSM and Overpass JSON to GeoJSON
Stars: ✭ 25 (-44.44%)
Mutual labels:  geojson
Go Geom
Package geom implements efficient geometry types for geospatial applications.
Stars: ✭ 456 (+913.33%)
Mutual labels:  geojson
Magellan
Geo Spatial Data Analytics on Spark
Stars: ✭ 507 (+1026.67%)
Mutual labels:  geojson
Terraformer
A geographic toolkit for dealing with geometry, geography, formats, and building geo databases
Stars: ✭ 643 (+1328.89%)
Mutual labels:  geojson
Gpxsee
GPS log file viewer and analyzer with support for GPX, TCX, KML, FIT, IGC, NMEA, SLF, SML, LOC, GPI, GeoJSON and OziExplorer files.
Stars: ✭ 406 (+802.22%)
Mutual labels:  geojson
Mapbox Gl Js
Interactive, thoroughly customizable maps in the browser, powered by vector tiles and WebGL
Stars: ✭ 8,017 (+17715.56%)
Mutual labels:  geojson
Echarts Map Demo
echarts地图geoJson行政边界数据的实时获取与应用,省市区县多级联动下钻,真正意义的下钻至县级【附最新geoJson文件下载】
Stars: ✭ 549 (+1120%)
Mutual labels:  geojson
Django Rest Framework Gis
Geographic add-ons for Django REST Framework. Maintained by the OpenWISP Project.
Stars: ✭ 830 (+1744.44%)
Mutual labels:  geojson
France Geojson
Contours des régions, départements, arrondissements, cantons et communes de France (métropole et départements d'outre-mer) au format GeoJSON
Stars: ✭ 462 (+926.67%)
Mutual labels:  geojson
Koop
🔮 Transform, query, and download geospatial data on the web.
Stars: ✭ 505 (+1022.22%)
Mutual labels:  geojson
Turf
A modular geospatial engine written in JavaScript
Stars: ✭ 6,659 (+14697.78%)
Mutual labels:  geojson
Leaflet.vectorgrid
Display gridded vector data (sliced GeoJSON or protobuf vector tiles) in Leaflet 1.0.0
Stars: ✭ 436 (+868.89%)
Mutual labels:  geojson
Disatbot
DABOT: Disaster Attention Bot
Stars: ✭ 26 (-42.22%)
Mutual labels:  geojson
Mapbox Gl Native
Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL
Stars: ✭ 4,091 (+8991.11%)
Mutual labels:  geojson
Geojson
Python bindings and utilities for GeoJSON
Stars: ✭ 607 (+1248.89%)
Mutual labels:  geojson
Schema
JSON Schema for GeoJSON
Stars: ✭ 39 (-13.33%)
Mutual labels:  geojson
Wellknown
WKT <-> GeoJSON
Stars: ✭ 15 (-66.67%)
Mutual labels:  geojson
Awesome Cn Cafe
A curated list of awesome coffee places in China.
Stars: ✭ 752 (+1571.11%)
Mutual labels:  geojson

togpx

Converts GeoJSON to GPX.

Build Status

Usage

  • as a command line tool:

      $ npm install -g togpx
      $ togpx file.geojson > file.gpx
    
  • as a nodejs library:

      $ npm install togpx
    
      var togpx = require('togpx');
      togpx(geojson_data);
    
  • as a browser library:

      <script src='togpx.js'></script>
    
      togpx(geojson_data);
    

API

togpx( geojson, options )

  • geojson: the GeoJSON data.
  • options: optional. The following options can be used:
    • creator: Specify a creator string that is used to specify the software that created the final GPX file. Default is togpx.
    • metadata: An object containing metadata about the to be converted dataset. Will be included in the GPX in the <metadata> tag. Usefull for providing information like copyright, time, desc, etc.
    • featureTitle: Defines a callback that is used to construct a title (<name>) for a given GeoJSON feature. The callback is called with the GeoJSON feature's properties object.
    • featureDescription: Defines a callback that is used to construct a description (<desc>) for a given GeoJSON feature. The callback is called with the GeoJSON feature's properties object.
    • featureLink: Defines a callback that is used to construct an URL (<link>) for a given GeoJSON feature. The callback is called with the GeoJSON feature's properties object.
    • featureCoordTimes: Defines a callback that is called for each feature to determine timestamps of each coordinate. Gets called with the current feature as a parameter, must return an array of UTC ISO 8601 timestamp strings for each coordinate of the feature. Alternatively. this option can be a string, in which case the corresponding feature property is used to read the times array.

The result is a string of GPX XML.

GPX

The conversion from GeoJSON to GPX is (by definition) lossy, because not every GeoJSON feature can be represented with the simple data types present in GPX files and GPX does not support arbitrary feature properties. This library tries to convert as much geometry and information as possible:

  • Points are converted to Waypoints.
  • Lines are converted to Tracks.
  • (Multi)Polygons are represented as a Track of their outline(s).
  • By default, the name tag of GPX elements will be determined by a simple heuristic that searches for the following GeoJSON properties to construct a meaningful title: name, ref, id
  • By default, the desc tag of GPX elements will be constructed by concatenating all respective GeoJSON properties.
  • Elevation is included in the output if the GeoJSON coordinates contain altitude as a third value ([lon, lat, altitude])
  • Timestamps are included in the GPX output if the GeoJSON has a times or coordTimes property that is an array of UTC ISO 8601 timestamp strings. See the featureCoordTimes option for customizing this behaviour.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].