http://www.topografix.com/GPX/1/1

GPX (マーク付け言語)

[34] GPX は、GPS 測位で得た座標データの交換のための XML ベースのマーク付け言語です。この分野でのデファクト標準となっています。

仕様書

[33] 近代的な意味の仕様書は存在しないようです。 XML Schema スキーマが提供されています。

構文

[36] XML 1.0 を使います。

[38] XML 1.1 には言及されていませんが、実際に XML 1.1 を使った例は確認されていません。実装が XML 1.1 に対応しているのかどうかは謎です。

[97] UTF-8 を使うのが普通なようです。それ以外の文字コードの利用例があるのかは不明で、 実装が対応しているのかも不明です。

[95] XML宣言XML でも GPX でも必須ではありませんが、 実利用例を見ると含まれることが極めて多いです。 version1.0 に、 encodingUTF-8 に指定される場合が多いです。

[96] standaloneyesno に指定されることもままあります。しかし DOCTYPE が指定される例は見られず、 standaloneno に指定するのはおかしい。

[40] GPX の標準の語彙は、名前空間URL http://www.topografix.com/GPX/1/1 で定義されています。拡張は他の名前空間を使うことがあります。

[62] GPX 1.0 時代の名前空間URL http://www.topografix.com/GPX/1/0 が使われることもあります。 たまに見かけますが、どの程度流通しているのかは不明です。

[83] GPX 1.0GPX 1.1 では一部の要素の用法や名前が違っていたりします。 わずかな違いなので、無視して GPX 1.1 として処理しても大きな問題はなさそうです。

[39] 文書要素として gpx 要素を使います >>37

gpx 要素

[41] gpx 要素は、 文書要素です >>37

属性

[49] version 属性は必須です。値は 1.1 でなければなりません。 >>37

[99] この属性を見ている実装があるのかどうか不明です。 そもそも名前空間属性と意味がかぶっており、 何のために存在しているのかも不明です。 GPX を生成するソフトウェアは、念の為常に値 1.1 を設定するべきでしょう。 GPX を読み込むソフトウェアは、 常に無視するべきです。


[50] creator 属性は必須です >>37


[48] xsi:schemaLocation 属性が指定されることがよくあります。

[100] XML Schema での処理を想定したものですが、実際にはほとんど役に立ちません。 GPX を生成するソフトウェアは、無駄なだけなので、 この属性を設定するべきではありません。 GPX を読み込むソフトウェアは、 常に無視するべきです。

内容

[42] 次のものを内容として含めることができます >>37

  1. [43] metadata 要素 (0-1)
  2. [44] wpt 要素 (0-∞)
  3. [45] rte 要素 (0-∞)
  4. [46] trk 要素 (0-∞)
  5. [47] extensions 要素 (0-1)

[106] wpttrk より前に置くことが多いようです。

MIME 型

[32] 公式な規定は無いみたいです。

[9]

[93] application/gpx+xml を使うのが最も好ましそうです。

[94] charset 引数が用いられることもあります。

拡張子

[35] .gpx がよく使われるようです。

処理

[90] GPX Parsing が処理方法を規定しています。

応用

[101] GPSロガーなどで記録した GPS による座標の時系列データと、 それに付随する各種情報 (心拍数加速度など) を交換するために用いられることが多いです。 これには trk 要素が用いられます。

ファイル例

[8] http://www.yamareco.com/modules/yamainfo/download-gpx.php?route_id=332

application/gpx+xml

[10] http://latlonglab.yahoo.co.jp/route/get?id=8ef4df3bfb5dfa5870dca1867ce2833f&format=gpx

application/gpx; charset=UTF-8

[11] http://labs.coruscantconsulting.co.uk/garmin/gpxgmap/load.php?d=default&lang=en&elev=off&trk=off&o=gpx&cmt=off&desc=off&w=on&gdata=goo.gl%2Fmaps%2FTFxlI

application/gpx+xml; charset=utf8

[26] http://www.yamakei-online.com/cl_record/output_gps.php?id=55413&fid=1

text/plain; charset=UTF-8

[51] Google Maps dynamic GPX example ( 版) http://www.gpsvisualizer.com/examples/google_gpx.html

[52] stefanocudini/googletrace: Create and store online gpx traces over on Google Maps and OpenStreetMap Sat ( 版) https://github.com/stefanocudini/googletrace

[53] ultigpx/example1.gpx at master · Knio/ultigpx ( 版) https://github.com/Knio/ultigpx/blob/master/example1.gpx

[54] ultigpx/example2.gpx at master · Knio/ultigpx ( 版) https://github.com/Knio/ultigpx/blob/master/example2.gpx

[55] share-tracks/sentiero.catalupo.gpx at master · stefanocudini/share-tracks ( 版) https://github.com/stefanocudini/share-tracks/blob/master/gpxs/sentiero.catalupo.gpx

[56] share-tracks/chia.fosso.gpx at master · stefanocudini/share-tracks ( 版) https://github.com/stefanocudini/share-tracks/blob/master/gpxs/chia.fosso.gpx

[58] geotools-2.7.x/sample_gpx_file_01.gpx at master · boundlessgeo/geotools-2.7.x ( 版) https://github.com/boundlessgeo/geotools-2.7.x/blob/master/modules/unsupported/gpx2/test/org/geotools/gpx2/resources/sample_gpx_file_01.gpx

[59] geotools-2.7.x/sample_gpx_file_02.gpx at master · boundlessgeo/geotools-2.7.x ( 版) https://github.com/boundlessgeo/geotools-2.7.x/blob/master/modules/unsupported/gpx2/test/org/geotools/gpx2/resources/sample_gpx_file_02.gpx

[61] ( 版) http://www.ic.daito.ac.jp/~mizutani/gps/data/2013_aug26_toyara.gpx

MIME型なし

[66] http://www.routeyou.com/product/file/2062078.en

binary/octet-stream

[67] ppl/ybaf.gpx at master · tonymorris/ppl ( 版) https://github.com/tonymorris/ppl/blob/master/ybaf.gpx

[68] geocache/GCXXXX.gpx at master · LinusU/geocache ( 版) https://github.com/LinusU/geocache/blob/master/GCXXXX.gpx

GPX 1.0 + 独自拡張

[70] django-gpxpy/test_track.gpx at master · PetrDlouhy/django-gpxpy ( 版) https://github.com/PetrDlouhy/django-gpxpy/blob/master/tests/test_data/test_track.gpx

[71] kalenji-gps-watch-reader/test/integrated at master · lincomatic/kalenji-gps-watch-reader ( 版) https://github.com/lincomatic/kalenji-gps-watch-reader/tree/master/test/integrated

[72] GPS/GPS/GPX at master · ratchasak/GPS ( 版) https://github.com/ratchasak/GPS/tree/master/GPS/GPX

xmlns なし

[73] osmawalk/text/experiments at master · xtompok/osmawalk ( 版) https://github.com/xtompok/osmawalk/tree/master/text/experiments

[74] masterarbeit/1115401-0008.gpx at master · martinusdipobagio/masterarbeit ( 版) https://github.com/martinusdipobagio/masterarbeit/blob/master/agg2graph_martinus/test/raw-data/autobahn/1115401-0008.gpx

名前空間整形式

[75] masterarbeit/agg2graph_martinus/test/raw-data at master · martinusdipobagio/masterarbeit ( 版) https://github.com/martinusdipobagio/masterarbeit/tree/master/agg2graph_martinus/test/raw-data

[76] Farm-bbd/[unused] nesudeti at master · macke4ever/Farm-bbd ( 版) https://github.com/macke4ever/Farm-bbd/tree/master/%5Bunused%5D%20nesudeti

[77] TrainCollServer/TrainCollSimulator/src/main/resources/gpx/lodz-waw-lodz[2015-07-04] at master · jbentyn/TrainCollServer ( 版) https://github.com/jbentyn/TrainCollServer/tree/master/TrainCollSimulator/src/main/resources/gpx/lodz-waw-lodz%5B2015-07-04%5D

[78] monongalia-preston-wv-trail-maps/coopers-rock-state-forest/gpx at master · masneyb/monongalia-preston-wv-trail-maps ( 版) https://github.com/masneyb/monongalia-preston-wv-trail-maps/tree/master/coopers-rock-state-forest/gpx

[79] mapedit/GeopisteetVS.gpx at master · ekohalsti/mapedit ( 版) https://github.com/ekohalsti/mapedit/blob/master/editor/static/editor/jquery/GeopisteetVS.gpx

[80] TrackMap/app/src/main/assets at master · Flepsik/TrackMap ( 版) https://github.com/Flepsik/TrackMap/tree/master/app/src/main/assets

[81] iOSMapWorks/C.gpx at master · CoffeeRoom/iOSMapWorks ( 版) https://github.com/CoffeeRoom/iOSMapWorks/blob/master/src/TrailsAlpha%202/TrailsAlpha/C.gpx

[98] http://api.openstreetmap.org/api/0.6/trackpoints?bbox=0,51.5,0.25,51.75&page=0 application/xml; charset=utf-8

<gpx version="1.0" creator="OpenStreetMap.org" xmlns="http://www.topografix.com/GPX/1/0">

[108] https://res.cloudinary.com/utmb-world/raw/upload/v1681323452/snowdonia/GPX%20Files/UTS_100_M_V5_6_41eb280377.gpx

日時が行ったり来たり。標高があったりなかったり。

実装

[22] GPX の入出力に対応したネイティブアプリは多数あるようです。

[23] Webアプリケーションはそれほど多くないようです。

[13] Bing地図

application/x-unknown; charset=utf-8

[15] http://www.ecoris.co.jp/contents/maptool.html

application/octet-stream

[24] Strava (WebサイトAPI)

[64] GPX Aviation Waypoint Generation ( 版) http://navaid.com/GPX/

[107] wakaba/js-gpx-parser, https://github.com/wakaba/js-gpx-parser

関連

[82] 似たデータ形式として KML があります。 GPX の方が普及しているようですが、 Google Maps のように KML のみ対応している実装もあるので、 両方に対応している実装もいくつもあります。

メモ

[1] ( 版) http://npgpx.sourceforge.net/

NPGPX - the GPX plugin

NPGPX is a plugin that loads and displays GPX files directly in your browser window. It supports zooming and panning, as well as simple graphical settings. It should work with Mozilla and Mozilla-like browsers such as Firefox or Netscape.

GPX, or the GPS eXchange format, is an XML-based file format that is designed to store GPS data - waypoints, routes, and tracks. It is used by many GPS programs, for example Quantum GIS and GPSBabel. The specification of the GPX format, and other useful documentation, can be found here.

[2] ( 版) http://npgpx.sourceforge.net/demo.html

<EMBED TYPE="text/gpx" SRC="arjeplog04.gpx" WIDTH=350 HEIGHT=350

ALT="You don't have the NPGPX plugin!">

[3] GPX - Wikipedia ( 版) https://ja.wikipedia.org/wiki/GPX

[5] Strava Uploads V3 API ( 版) https://strava.github.io/api/v3/uploads/

The base version of GPX does not allow for the inclusion of heartrate, cadence, distance or temperature data. As a result, extensions to GPX were created and Strava supports the two most popular plus a general format. The extensions extend the <trkpt> tag to include extra attributes with each datapoint.

Garmin’s Track Point Extension v1

From the extensions available, Strava extracts:

atemp as temperature

hr as heartrate.

Cluetrust GPX extension

From the extensions available, Strava extracts:

cadence as cadence

distance as distance

hr as heartrate

temp as temperature.

Strava also detects general tags placed in the <extensions> tag of each <trkpt> tag. Strava extracts:

cadence as cadence

distance as distance

heartrate as heartrate

power as power.

[6] ( 版) http://www8.garmin.com/xmlschemas/TrackPointExtensionv1.xsd

[7] http://www.cluetrust.com/Schemas/gpxdata10.xsd

[12] Google Maps to GPX Converter (Sverrir Sigmundarson 著, 版) http://labs.coruscantconsulting.co.uk/garmin/gpxgmap/convert.php

[14] やっと巡り会えた、GPSロガーの軌跡上の位置の「時刻」も分かるGPXビュアー:GPS Tracks/GPS Tracks HD « アメリカより ( 版) http://blogfromamerica.com/?p=15376

無料・有料を含めて、GPXファイル(GPSロガーが保存するファイルタイプ)を表示するアプリを探してみたのですが、なんと、地図上に軌跡のみを表示するアプリは沢山有っても、任意の軌跡上の点の時刻を表示するものと、軌跡を始点から終点まで再生して辿ってくれるアプリが、殆ど無いこと!

結局、20以上のアプリをダウンロードし、数十ドルのお金を有料アプリに費やしました。

そして、もう諦めて、「これこそ、自分で自分の目的に合ったGPXビュアー・アプリを開発しなければならないか!?」と思っていたときに、やっと、それなりに自分の目的に叶うアプリを探し当てることが出来ました!

■ GPS Tracks/GPS Tracks HD (開発元:DMomeault)

それが、

● GPS Tracks、iPhone対応(iPad/iPad Miniでも使える) $0.99

● GPS Tracks HD、iPad/iPad Mini専用 $3.99

です。

[16] 【GPSロガー】GPX形式をITM形式に変換するウェブアプリを作りました。 | KUMA TYPE ( 版) http://blog.kumacchi.com/2013/04/25/2352

ezTourはITM形式以外のデータを読み込めないのです。

しかし、山旅ロガーはITM形式でログを出力できないわけです。GPX形式とKML形式なら出力できるので、GPXとかKMLで出力してみたわけです。

[17] 【GPSロガー】GPX形式をITM形式に変換するウェブアプリを作りました。 | KUMA TYPE ( 版) http://blog.kumacchi.com/2013/04/25/2352

山旅ロガーとezTourで生成したGPXファイルの中では見たことが無かったのですが、他のソフトで、一つの<trk></trk>タグの中に<trkseg></trkseg>タグが複数存在する場合が、有るよう

[18] 【GPSロガー】GPX形式をITM形式に変換するウェブアプリを作りました。 | KUMA TYPE ( 版) http://blog.kumacchi.com/2013/04/25/2352

GPXファイルのspeedエレメントは「メートル/秒」で有ることが判明したので、時速に変換してから登録するようにした。

speedエレメントがない場合、座標と時刻から自力で速度を算出するように改良した。

[19] GPX2ITM コンバータ - GPXファイルをITMファイルに変換 ( 版) http://gpx2itm.kmake.net/

[20] Why not GPX? - OpenStreetMap Wiki ( 版) http://wiki.openstreetmap.org/wiki/Why_not_GPX%3F

[21] GPX - OpenStreetMap Wiki ( 版) http://wiki.openstreetmap.org/wiki/GPX

[25] JavaScript版 あしあとデータ to GPX コンバーター ( 版) http://cs88.awardspace.info/ashiato2gpx/

[27] GPX-POI file generator ( 版) http://gpx-poi.com/

[28] Default handler for mime type application/gpx+xml · Issue #527 · cgeo/cgeo ( 版) https://github.com/cgeo/cgeo/issues/527

I can see that results from pocket queries have Content-Type: application/gpx; - so we would probably need to register for both:

Content-Type: application/gpx;

Content-Type: application/gpx+xml;

[29] #4768 (GPX download Content-Type should be "application/gpx+xml") – OpenStreetMap ( 版) https://trac.openstreetmap.org/ticket/4768

It would be convenient if the Content-Type of GPX downloads was "application/gpx+xml" instead of "text/xml". This would match the media type defined for GPX on Wikipedia (​http://en.wikipedia.org/wiki/GPS_eXchange_Format), and would allow better support for GPX-enabled applications to be selected automatically by the browser/operating-system when users click on download links.

For example on iPhone Safari will render text/xml documents itself rather than passing them off to an appropriate application. If the Content-Type was application/gpx+xml then Safari would search for an installed application that knew how to handle GPX files and allow the user to open the download in that app.

[30] Open gpx files from browser ( 版) http://help.locusmap.eu/topic/open_gpx_files_from_browser

At first glance it looks like maybe Locus needs to register for the application/gpx+xml mime type (in addition to application/gpx)?

[31] add application/x-gpx+xml, application/x-osm+xml, application/x-esri-shape to the mime-type database | Review Request | Review Board ( 版) https://git.reviewboard.kde.org/r/106977/

[57] RouteConverter/gpx/src/main/doc at master · cpesch/RouteConverter ( 版) https://github.com/cpesch/RouteConverter/tree/master/gpx/src/main/doc

[60] 独り言日記(2009/12) - FreeStyleWiki ( 版) http://ft-lab.ne.jp/cgi-bin/wiki.cgi?page=%C6%C8%A4%EA%B8%C0%C6%FC%B5%AD%A1%CA2009%2F12%A1%CB#p40

<gpx version="v1.1.5"

creator="iTravel Tech Inc. - http://www.itravel-tech.com"

[63] GPX - GPS Exchange Format ( 版) http://www.gdal.org/drv_gpx.html

Expat library supports reading the following built-in encodings :

US-ASCII

UTF-8

UTF-16

ISO-8859-1

OGR 1.8.0 adds supports for Windows-1252 encoding (for previous versions, altering the encoding mentioned in the XML header to ISO-8859-1 might work in some cases).

The content returned by OGR will be encoded in UTF-8, after the conversion from the encoding mentioned in the file header is.

[65] GPXM-file | RouteYou Help ( 版) http://help.routeyou.com/en/topic/view/262/gpxm-file

A GPXM-file is a digital representation of the route you can create and see on RouteYou. GPXM is the format, based and compatible with GPX (GPS eXchange Format), but extended with a set of features to make full use of the content provided and created on RouteYou.

[69] GeoCache GPX Example.gpx ( 版) https://gist.github.com/ssx/619665

[84] M241のgps解析 ( ()) http://tancro.e-central.tv/grandmaster/gpx/m241-gpx.html

速さの値としてDESC要素とSPEED要素との関係であるが、DESC要素で表示されているm/hの表示は間違いでkm/hが正しい。SPEED要素の単位はm/sである。

[85] Location Plus A1解析 ( ()) http://tancro.e-central.tv/grandmaster/gpx/a1wh-gpx.html

文字コード

Shift_JIS

改行コード

LF

1行目

<?xml version="1.0"?>

[86] GPXデータを簡略化 - 330k.info ( ()) http://www.330k.info/software/simplify_gpx

自転車ツーリング中は事前にGoogle MapsとGMapToGPXで作っておいた走行ルートをGPXファイルにし、

AndroidのRMapsや地図ロイドに読み込ませて走行ルートを確認しているのだが、

GPXファイルに余分な要素があると、処理に時間がかかってしまう(あまりに重いと処理できないこともある)。

そこでtrkpt要素の子要素(eleやcmt、timeなど)を根こそぎ削除し、lat属性とlon属性のみを残すスクリプトを作成した。

また、[Mathematica] 折れ線を間引くのアルゴリズム(Douglas-Peucker)を用いて、GPSログ中のポイントを間引く機能も実装してみた。

[87] 轍 ONLINE - GPSログを写真付きで地図上に表示・共有するサービス ( ()) http://map.cyclekikou.net/

[88] Uploading GPS files without time information – Strava Support ( ()) https://support.strava.com/hc/en-us/articles/216917947-Uploading-GPS-files-without-time-information

[89] NeoRun 山行計画(GPX)編集マニュアル () https://go-wellness.epson.com/neo-run/contents/pdf/trek_gpx_manual.pdf

[91] Spatial Data on the Web IG F2F - Day 2/2 – 06 June 2018 () https://www.w3.org/2018/06/06-sdw-minutes.html#x14

[92] GPX Developers Forum - Yahoo Groups () https://groups.yahoo.com/neo/groups/gpsxml/conversations/messages/2386

[102] external/leaflet.elevation/spec/test.gpx · c97681e0a0df62d4b929a7bd5f3eb8c046fd8f47 · Diego Andrés Ramírez Aragón / BikeTracks · GitLab () https://repo.lowfill.com/dramirez/BikeTracks/blob/c97681e0a0df62d4b929a7bd5f3eb8c046fd8f47/external/leaflet.elevation/spec/test.gpx

[103] () https://howtotrailrun.salomon.com/medias/trail/330-trail-gpxdatas-iicss18_poland_krakw_10km.gpx

[104] Epson SF-810の心拍数をSportTracks3.1に読み込むためにGPXを編集した () https://thik.jp/jog/archives/epson-to-sporttracks-3

[105] トラックログ/GPXファイルの便利な活用方法。ナビゲーション、ネット活用、登山の振り返りが思いのままに! YAMAYA - ヤマケイオンライン / 山と渓谷社 () https://www.yamakei-online.com/yama-ya/detail.php?id=397