-
Notifications
You must be signed in to change notification settings - Fork 20
Proposal of a Common Opencaching GPX extension, see #344 #511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@opencaching/opencaching-pl-lead-programmers I suggest do deposit the XML schema definition at https://opencaching.pl/okapi/static/ocgpx. So it would be maintained in the OKAPI project, which ensures stability and compatibility across all OC sites and versions, while the reference file is at the PL site which is always most current due to automatic OKAPI deployment. Would you support this OC GPX extension on your websites, i.e. in native GPX generation in OCPL / OCDE code? I may also do the implementations for that. Do you have any comments or suggestions? I am not experienced in creating XML Schemas, just collected the information needed from tutorials and from existing GPX extensions. |
Example output: <gpx ... xmlns:oc="https://opencaching.pl/okapi/static/ocgpx/1" xsi:schemaLocation=" ... https://opencaching.pl/okapi/static/ocgpx/1 https://opencaching.pl/okapi/static/ocgpx/1/ocgpx.xsd > <wpt lat="45.020567" lon="7.037033"> <groundspeak:cache archived="False" available="True" id="1"> <groundspeak:name>My first cache</groundspeak:name> ... <groundspeak:log id="33"> <groundspeak:date>2017-09-02T21:26:00+02:00</groundspeak:date> <groundspeak:type>Didn't find it</groundspeak:type> ... <oc:log> <oc:uuid>426A3DF7-CF33-D83F-EB68-63711932E09F</oc:uuid> </oc:log> </groundspeak:log> </groundspeak:cache> <oc:cache> <oc:req_passwd>true</req_passwd> </oc:cache> |
okapi/static/ocgpx/1/ocgpx.xsd
Outdated
|
||
<xsd:complexType name="cache_type"> | ||
<xsd:sequence> | ||
<xsd:element name="logpw" type="xsd:boolean" minOccurs="1" maxOccurs="1" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This must be renamed to "req_passwd".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW - worth considering - perhaps we could replace this be a more generic A-code attribute element, and introduce a new A-code for this purpose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since A-codes are quite solid and backward compatible, developers could implement this logic by checking if a particular A-code is present. Also, the users of application which already display attributes, would get this information independently displayed, without the need of the developer implementing support for the new A-code.
(I was quite sure we already had an A-code for "requires passoword", but I checked, and it seems we don't.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some things to consider:
- There is already a way to deliver OC attributes in GPX, which is understood by some applications; it's called
attrs
=gc_ocde:attrs
in OKAPI. - The only major OKAPI App - c:geo - already processes the password requirement as indicated by the
req_passwd
flag of services/caches/geocache(s). Don't know how they display it. - It may be a good idea to show the password requirement in a more prominent way than an attribute. Because if you are in the field and forget to write down the password, you will not be able to log the cache later. OCPL therefore prominently inserst a text into the GPX description text which points out the password reqirement.
- It would be the first OKAPI-only attribute, because passwords are stored as strings, while OC attributes are stored as boolean flags. So it would need some change in the OKAPI attribute logic, and it could not be set in the same way like other attributes (see the new services/caches/edit method).
- The user's requests that lead to this proposal was to transfer the "requires password" flag from www.opencaching.de via GPX to c:geo.
All things considered, I would prefer to go for the quick solution and replicate the req_passwd
flag from services/caches/geocaches to GPX. Creating a new GPX attributes standard (besides of the already existing GC and OCDE standards) might be persued separately. Will do no harm if the "requires password" information would be available redundantly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do no harm if the "requires password" information would be available redundantly.
Yes, sure.
It's a pity I never found the time to finish the development of A-codes and S-codes. Probably never will... Despite this, my mind keeps finding new applications for them. :) If designed correctly, they would make such an elegant and forward-compatible model for expressing so many things...! ;)
okapi/static/ocgpx/1/ocgpx.xsd
Outdated
<?xml version="1.0" encoding="utf-8"?> | ||
<xsd:schema | ||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" | ||
xmlns="https://opencaching.pl/okapi/static/ocgpx/1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it's safer to use xmlns in OKAPI's github namespace? See here for example. GitHub URLs are highly unlikely to change, and we don't convey a bad impression that "this is for OCPL only".
I would even suggest to put this XSD outside of the OKAPI repository - we could make a separate repository solely for that single XSD (e.g. https://github.com/opencaching/gpx-extension
), and introduce semantic versioning similar to the one I used in the example linked above (stable-v1
branch). I have designed tons of XSDs in this fashion in recent years and it seems to be working very well, so far.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am fine with https://github.com/opencaching/gpx-extension
.
(Had in mind that there was a case when the Github path changed for such a document and OKAPI needed an adjustment. But maybe I am confusing this with something else.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if GitHub paths change (they didn't, since the time I started using GitHub), they still redirect properly. In other words, the URL in xmlns
will always work properly. This is not necessarily true for the "raw XSD" links used in xsi:schemaLocation
, such as this one, but these links can break, so it's not a big deal (in fact, we don't even need to provide xsi:schemaLocation
, if we don't want to).
okapi/static/ocgpx/1/ocgpx.xsd
Outdated
</xsd:documentation> | ||
</xsd:annotation> | ||
|
||
<xsd:element name="cache" type="cache_type" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're only trying to add attributes to an existing groundspeak:geocache
element, then I guess we shouldn't declare our own cache
element. Instead, we should declare only specific elements and annotate them properly (e.g. "this element can be put only as the child of the groundspeak:geocache
element").
Similar is true for the log
element below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree for the logs. They depend on groundspeak, because logs are added to GPX by the groundspeak extension.
oc:cache
(as proposed) is independent from groundspeak:cache
; it's directly attached to the wpt
element, which represents a geocache (it has <sym>Geocache</sym>
). There will probably be more Opencaching-specific cache attributes be added, so it may make sense to group them as oc:cache
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, sounds reasonable. wpt
can also represent "additional waypoint", but we may use a different element for extending this one.
I'm not an expert in XML stuff, but I would leave away the GPX and Groundspeak namespace declarations from your extension, e.g. lines 4 and 5 of https://github.com/opencaching/gpx-extension/blob/master/schema.xsd#L4. You are not really using them in your schema, but you are fixing their version number by doing so. This is a problem because Groundspeak GPX files come in different versions, and therefore some of those would not fit your extension. At least in theory, in practice basically no one actually verifies using the schemas from the namespace. :) |
I am referring to them, but only in the annotations, not the schema itself. You're right that they can be removed, but there's also nothing wrong with leaving them there, I think, and people who know XML Schema well, tend to look for prefix references there.
Are you sure? If I remember correctly, they attempted to introduce a new version, but they have backed out of it quite quickly, because it turned out that there were some applications which were xmlns-dependant. (BTW, it is correct for the app to be xmlns-dependant, this is exactly why XML namespaces were created for, after all. But many developers don't understand XML namespaces, hence the problems.) |
In the GC user profile, there is the choice of GPX version 1.0 and 1.0.1: GSAK offers the option of GPX "1.0" (which actually produces 1.0.1 files) and 1.1. If you select 1.1, it shows a warning: OC sites only produce GPX 1.0.1. |
The version 1.1 GSAK refers to is Topografix 1.1: http://www.topografix.com/GPX/1/1/gpx.xsd |
If I understood you correctly, you're saying that:
I don't gave a GC account so I might be missing something, but I was quite sure that "Topografix 1.0" + "Groundspeak 1.0.1" was the only true geocaching GPX standard, for many years now. And that the attempt to introduce "Groundspeak 1.1" was a failure. |
Sorry, I confused Topografix and Groundspeak versions. To sort things:
Surely it is the prevailing standard today, while some GC users will still download Topografix 1.0 + Groundspeak 1.0 (which |
Started as the result of the discussion in this thread: opencaching/okapi#511
This deserves an article :) https://github.com/opencaching/gpx-extension/blob/master/all-these-namespaces.md |
I wish everyone would understand that, and not blame cgeo for not importing GPX files, which are - from an XML point of view - not really GPX files. We meanwhile filter the underlying byte stream to get rid of some nasty things that never ever should appear in XML files. :) |
5ad607f
to
4d0284f
Compare
@@ -15,7 +15,7 @@ | |||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
xmlns:groundspeak="http://www.groundspeak.com/cache/1/0/1" | |||
xmlns:ox="http://www.opencaching.com/xmlschemas/opencaching/1/0" | |||
xmlns:oc="https://opencaching.pl/okapi/static/ocgpx/1" | |||
xmlns:oc="https://raw.githubusercontent.com/opencaching/gpx-extension/stable-v1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bad xmlns
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -27,8 +27,8 @@ | |||
http://www.opencaching.com/xmlschemas/opencaching/1/0 | |||
https://raw.githubusercontent.com/opencaching/okapi/master/etc/nsox.xsd | |||
|
|||
https://opencaching.pl/okapi/static/ocgpx/1 | |||
https://opencaching.pl/okapi/static/ocgpx/1/ocgpx.xsd | |||
https://raw.githubusercontent.com/opencaching/gpx-extension/stable-v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here too.
do it :-) |
OCPL also has support for log password. |
Furthermore, if OC specific information is considered to be included as having own namespace in GPX files, then I would recommend the following as well: OC has different / more cache types. One could declare such cache types using the namespaces according to Like:
Non-OC aware clients will show "unknown cache". Same goes for cache sizes, log types, waypoint types and especially attributes. |
OCPL inserts a localized text into the description text: "WARNING! You need a PASSWORD to log this cache. You have to either find in the cache (and remember to write it down) or obtain it according to the description!!!" This is something different than a "requires password" field in the GPX. The latter one will e.g. allow c:geo to prompt for a password then logging the cache. Currently you cannot log "found" GPX-imported caches at all with c:geo if they require a password. |
Yet the presence of this field is one step towards making that happen, right? |
The problem is that some users use tools to manage their caches like GSAK. The additional information will be lost as long as the tools do not work with the extended schema. |
@SammysHP |
With the proposed GPX extension and a request to other tools. ;) |
In general, external tools should avoid editing/removing XML elements they don't understand. Perhaps that's something that can be reported to GSAK authors as a feature-request? |
All tools that I know store the data in some sort of internal data structure that has a fixed set of fields. Some tools that should be notified: GSAK, Cachewolf, c:geo (already done), QLandkarte GT, QMapShack, Locus. I don't know any other tool that works explicitly with OpenCaching. |
I think so too. Because this is the easiest approach. It can be done in a better way, but it requires some work (in particular, the internal data structure would need to be able to hold "unknown XML elements"). And most authors probably won't be willing to do this work, but still, perhaps some good ones might :) |
6b59805
to
bd67717
Compare
No description provided.