1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【備忘録】位置情報の保存について

Posted at

iphoneでGPSデータを取得する際の保存形式(GPX,KML)についてメモします。

KML

KML は、Google Earth、Google マップ等で、地理データの表示に使用するファイル形式です。

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
     <Document>
          <name>名前</name>
          <Style id="id名">
               <LineStyle>
                    <color>線の色</color>
                    <width>線の太さ</width>
               </LineStyle>
          </Style>
          <Placemark>
               <name>目印の名前</name>
               <description>目印の説明</description>
               <styleUrl>#id</styleUrl>
               <LineString>
                    <extrude>1</extrude>
                    <tessellate>1</tessellate>
                    <altitudeMode>absolute</altitudeMode>
                    <coordinates>
                         経度1, 緯度1, 高度1
                         経度2, 緯度2, 高度2
                         経度3, 緯度3, 高度3
                    </coordinates>
               </LineString>
          </Placemark>
     </Document>
</kml>

<Style>タグ内で線についての情報を指定することができます。

タグ 説明
<LineStyle> 線の情報
<color> 線の色
<width> 太さ

<Placemark>タグ内で位置情報について記録することができます。

タグ 説明
<name> 目印の名前
<description> 目印の説明
<LineString> 位置情報を記録
<coordinates> 緯度、経度、高度の順で記録

GPX

GPXは、アプリケーションとWebサービスの間でGPSデータを交換するための軽量のXMLデータ形式です。

<gpx xmlns="http://www.topografix.com/GPX/1/0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" creator="GPS Visualizer http://www.gpsvisualizer.com/" version="1.0" xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">
     <trk>
          <name>名前</name>
          <trkseg>

               <trkpt lat="緯度1" lon="経度1">
                    <ele>高度1</ele>
                    <time>日付1</time>
               </trkpt>
               <trkpt lat="緯度2" lon="経度2">
                    <ele>高度2</ele>
                    <time>日付2</time>
               </trkpt>

          </trkseg>
     </trk>
</gpx>

<trkpt>タグ内で1つの位置情報を記録していきます。
取得回数分<trkpt>タグが増えるため、kmlよりもファイルサイズが大きくなります。

タグ 説明
<time> 日付(yyyy-mm-dd HH:mm:ss
<ele> 高度

参考

GPSデータ記録形式 KMLとGPX

KML

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?