Fa:GPX

From OpenStreetMap Wiki
Jump to navigation Jump to search

GPX یا GPS exchange format یا قالب تبادل جی‌پی‌اس یک فایل با قالب XML است که داده‌های مختصاتی را ذخیره می‌کند. این قالب فایل توانایی ذخیره‌سازی نقاط بین‌راهی (waypoints)، ردها (tracks) و مسیرها (routes) را دارد به‌طوری که پردازش و تبدیل آن به سایر قالب‌ها آسان باشد. همهٔ داده‌های جی‌پی‌اس که در اوپن‌استریت‌مپ استفاده می‌شود باید قبل از بارگذاری به قالب GPX تبدیل شوند.

مثال

در ادامه قسمتی از یک فایل نمونه را آورده‌ایم تا با نحوهٔ قرارگیری یک نقطهٔ بین‌راهی (با نام LAGORETICO) و دنباله‌ای از نقاط رد در فایل GPX آشنا شوید:

<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.0">
	<name>Example gpx</name>
	<wpt lat="46.57638889" lon="8.89263889">
		<ele>2372</ele>
		<name>LAGORETICO</name>
	</wpt>
	<trk><name>Example gpx</name><number>1</number><trkseg>
		<trkpt lat="46.57608333" lon="8.89241667"><ele>2376</ele><time>2007-10-14T10:09:57Z</time></trkpt>
		<trkpt lat="46.57619444" lon="8.89252778"><ele>2375</ele><time>2007-10-14T10:10:52Z</time></trkpt>
		<trkpt lat="46.57641667" lon="8.89266667"><ele>2372</ele><time>2007-10-14T10:12:39Z</time></trkpt>
		<trkpt lat="46.57650000" lon="8.89280556"><ele>2373</ele><time>2007-10-14T10:13:12Z</time></trkpt>
		<trkpt lat="46.57638889" lon="8.89302778"><ele>2374</ele><time>2007-10-14T10:13:20Z</time></trkpt>
		<trkpt lat="46.57652778" lon="8.89322222"><ele>2375</ele><time>2007-10-14T10:13:48Z</time></trkpt>
		<trkpt lat="46.57661111" lon="8.89344444"><ele>2376</ele><time>2007-10-14T10:14:08Z</time></trkpt>
	</trkseg></trk>
</gpx>

چگونه می‌توانم فایل GPX خودم را روی یک نقشهٔ OSM نشان دهم؟

See track drawing websites. Also you may use other software; there are many which offer GPX displaying. For showing a GPX track for the purpose of editing OSM, see editing.

رفع اشکال

چرا فایل GPX من به‌درستی بارگذاری نمی‌شود؟

فایل GPX شما باید از نقاطی (trackpoints) با مهرهای زمانی معتبر (valid timestamps) تشکیل شده باشد. برچسب ele(elevation یا ارتفاع) اختیاری است و پیش‌فرضش 0 است.

اگر از دستگاه جی‌پی‌اس گارمین استفاده می‌کنید توجه داشته باشید: بسیاری از این دستگاه‌ها این قابلیت را دارند که رد را بدون مهرهای زمان (timestamps) ذخیره کنند. ردهایی که به این صورت ذخیره شوند در OSM بارگذاری نمی‌شوند. بنابراین مطمئن شوید فایل جی‌پی‌ایکسی که بارگذاری می‌کنید از رد فعال بر روی دستگاه باشد نه از ردی که قبلاً ذخیره کرده‌اید.

اگر نرم‌افزاری می‌سازید که فایل GPX تولید می‌کند، یکی از اعتبارسنج‌ها را با استفاده از Schema validation به‌کار ببرید (مثلاً xmlvalidation) تا مشکلات بالقوه را پیدا کنید. اگر از برچسب encoding استفاده می‌کنید، مقدار UTF-8 درست است و utf8 (بدون خط تیره) درست نیست.

قالب فایل‌های GPX به‌شکل زیر موردقبول است:

<?xml version="1.0"?>
<gpx
 version="1.0"
creator="GPSBabel - http://www.gpsbabel.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/0"
xsi:schemaLocation="http://www.topografix.com/GPX/1/0
http://www.topografix.com/GPX/1/0/gpx.xsd">
<time>2005-11-07T14:00:09Z</time>
<trk>
  <name>ACTIVE LOG</name>
<trkseg>
<trkpt lat="52.564001083" lon="-1.826841831">
  <ele>115.976196</ele>
<time>2005-11-07T12:03:31Z</time>
</trkpt>
</trkseg>
</trk>
</gpx>

GPX 1.1 نیز درست است:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<gpx version="1.1"
    creator="EMTAC BTGPS Trine II DataLog Dump 1.0 - http://www.ayeltd.biz"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://www.topografix.com/GPX/1/1"
    xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
<metadata>
<name>GPS Receiver track log</name>
<desc>Tallinn (car)</desc>
<author>
<name>Michael Collinson</name>
<email id="mikes" domain="ayeltd.biz" />
<link href="http://www.ayeltd.biz"><text>AYE Ltd.</text></link>
</author>
<time>2007-10-02T09:22:06Z</time>
<keywords>Estonia, Tallinn, A. Weizbergi</keywords>
<bounds minlat="59.4367664166667" maxlat="59.4440920666666" minlon="24.74394385" maxlon="24.7971432"/>
</metadata>
<trk>
<src>Logged by Michael Collinson using EMTAC BTGPS Trine II</src>
<link href="http://www.ayeltd.biz"><text>AYE Ltd.</text></link>
<trkseg>
    <trkpt lat="59.4408327" lon="24.74516185">
        <ele>44</ele>
        <time>2007-10-02T07:54:30Z</time>
        <fix>3d</fix>
        <hdop>300</hdop><vdop>300</vdop><pdop>300</pdop>
    </trkpt>
</trkseg>
</trk>
</gpx>

دو چیز هست که واردکننده انجام نمی‌دهد: اول اینکه نقاط جی‌پی‌اسی که مهر زمان نداشته باشند نادیده گرفته می‌شوند، زیرا مهر زمان برای استخراج سرعت و... به‌کار می‌رود. دوم اینکه نقاط بین‌راهی (waypoints) و فایلی که فقط حاوی نقاط بین‌راهی باشد وارد نمی‌شود. باز و ذخیره کردن فایل با نرم‌افزار GPX Editor برخی مشکلات را برطرف می‌کند. اگر فایل شما مهر زمان نداشته باشد، این برنامه می‌تواند مهرهای زمان جعلی به فایل اضافه کند (زمان غیرقابل شناسایی).

If you can't get your GPX with timestamps, you can use JOSM's EditGPX plugin, open your GPX file, click on the edit GPX tracks icon, choose your GPX file in the popup and then right click on the new GPX layer and convert it to a "GPX layer with anonymised time". Save this new GPX layer as a file and upload it to OSM.

Alternative option for command line users (e.g. for a Bash shell on a GNU/Linux system):

$ xmlstarlet ed -N x=http://www.topografix.com/GPX/1/0 -N y=http://www.topografix.com/GPX/1/1 \
    -s '//x:trkpt|//y:trkpt' -t elem -n time -v 1970-01-01T00:00:00Z track.gpx > track-nulltime.gpx

The reason for this is that if you reset many GPS units or download map data to them, then you often get copyrighted data put in the GPX. The most famous example is that if you reset a Garmin GPS unit then it will put the locations of the Garmin offices around the world as waypoints on the unit.

Tracks will fail to upload if data formats are not correct, for example my GPS setup occasionally throws in a NaN as an elevation value. Deleting those lines from the file fixes the upload.

مشکل دیگری که می‌تواند رخ دهد وجود یک علامت "&" در نام نقطهٔ بین‌راهی است. مثلاً

<wpt lat="-20.089861" lon="57.511535">
    <name>The Grand Mauritian resort & spa</name>

کار نمی‌کند و با خطای "Generic XML parse error" روبه‌رو می‌شوید. اما:

<wpt lat="-20.089861" lon="57.511535">
	<name>The Grand Mauritian resort and spa</name>

کار می‌کند.

Another reason for import failure may be on the server-side. Please consult the platform status page to see whether a technical problem is known that prevents even correct gpx files from being imported.

Why are the points on my tracks spaced out?

This is due to the GPS device (usually a Garmin) being set to record on 'Auto', which saves space by recording fewer points on straights. It's not usually a problem in rural areas, but isn't much use for city mapping. To make the GPS record more points, go to the track settings menu on your GPS, and change the recording method to either 'Time', or 'Distance'.

  • Time: Time will record points every 'x' seconds/minutes/hours. This can be changed on some GPS devices. Having this setting will use up the memory fast, but will increase the points considerably. The disadvantage of this method of saving is that when moving slowly with the GPS device the points will become densely packed. For example, many Garmin GPS's have a maximum tracklog capacity of 10,000 points. (Note that some devices also allow a log to be stored on a memory card in addition to the regular tracklog.) Setting a time interval of 1 second normally gives close to 3 hours of mapping (always a few points are not written due to errors and satellite availability). For fast road driving a 1 second interval gives very good trace information. The 1 second interval also works well for cycling in urban areas. For walking the rate can be decreased without loss of track definition to 2 or 3 seconds. The interval can also be increased when the mapping time needs to be extended but try to avoid unnecessary time intervals. You can change the time interval on the fly, useful if you decide to stay out longer than planned. If your GPS-Unit doesn't impose you serious restrictions on storage capability experienced mappers generally use a setting of 1 point/s to get best results in all mapping conditions. Some advantages of the time setting are that relative speed can be judged by the spacing, There are more points when you slow down for curves or turns and less on straightaways where you need fewer points.
  • Distance: Distance will record points every 'x' meters/yards. This can be changed on some GPS devices. Having this setting will use up the memory fast, although relative to your speed. The disadvantage of this method of saving is that when traveling on straight roads fast, (motorways/highways), unnecessary points will be recorded. Also if you are to be tracking a small area, if the 'x' value is too high, your route will be unclear. In general distance recording can miss the subtleties of curves and direction changes, especially in urban areas.
  • Wrapping: If the option is available to turn on, or off the wrapping function, then having it off is also advised. Having wrapping on means that when full, the GPS device will make room to record the latest section of your route, by deleting the beginning of your route. It will delete the beginning, point by point, at the same rate as new points are created. The exception would be when you are logging track data to a data card in some Garmin models. The beginning data will be deleted from the device's built in memory, but not from the data card.

See also