-
Notifications
You must be signed in to change notification settings - Fork 112
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
More Revision-Control-friendly file format #1290
Comments
|
FTR the request for XML format documentation is tracked in #182. |
Thanks.
I am not sure I understand what this means... As a side note, #1097 asks pretty much the opposite. |
When you add/remove a color, it will trigger changes in a number of symbols. I don't see a conflict with #1097, because it will affect objects only when they are modified anyway. It addresses revision control at an object level, while |
For the record: I was trying to write a conversion script from .omap to SVG, but found the file structure not really friendly to 3rd party tools. It contains the "noise" (undos & redos, map view), weirdly named elements ("barrier") and, despite being verbose in general, the coordinates itself are not atomic and hard to parse... |
@jmacura If you want to process the XML, you should better use the The barrier elements are used when a file format change would cause serious trouble (crash, misrepresentation) with slighly older versions of the software. This is easy to handle when reading an XML stream, but could be more difficult with an XML tree. "Noise" isn't a fair assessment outside of the revision control perspective, at least as long as users expect to continue their work were they left it. |
I think this kind of metadata (like open files, views, zoom settings) is typically stored in a separate file by IDE-s and such. Not sure if this might apply to Mapper. |
At the moment, the
Once implemented in Mapper, this would be enough to safeguard current versions against misbehaviour with files written by future versions. Other software could handle it as needed, including just ignoring it. Implementing this change for map reading now, it may become the standard for writing in a later version. |
Task: GH-1290 (revision control friendly file format)
My first thought was that Mapper is more like a document editor (e.g. Word, PowerPoint), less like an IDE. (How many map makers do know what an IDE is?) However, when looking at the collection of templates used with a map, the perspective changes. Still, I'm not convinced that yet another file is really desirable. |
Saving undo information can be turned off in the settings. |
After '<barrier ... action="skip"/>', skip the element immediately following this barrier. This variant of the barrier allows to achieve the same effect as the existing "wrapping" variant, but without changing the structure of the document tree significantly, thus possibly facilitating third-party implementations of the format. Mapper does not yet use this variant for export, but may switch at version 1.0. Task: GH-1290 (revision control friendly file format)
Task: GH-1290 (revision control friendly file format)
After '<barrier ... action="skip"/>', skip the element immediately following this barrier. This variant of the barrier allows to achieve the same effect as the existing "wrapping" variant, but without changing the structure of the document tree significantly, thus possibly facilitating third-party implementations of the format. Mapper does not yet use this variant for export, but may switch at version 1.0. Task: GH-1290 (revision control friendly file format)
Task: GH-1290 (revision control friendly file format)
After '<barrier ... action="skip"/>', skip the element immediately following this barrier. This variant of the barrier allows to achieve the same effect as the existing "wrapping" variant, but without changing the structure of the document tree significantly, thus possibly facilitating third-party implementations of the format. Mapper does not yet use this variant for export, but may switch at version 1.0. Task: GH-1290 (revision control friendly file format)
Saving the same map file (without changes) in OOM on Linux and Android (same version number 0.9.4) does not produce exactly the same .omap file content.
|
Indeed. This is a
Unsure. You are looking at Linux and Android which do have a common root directory |
I see! Then a quick fix would be to order the tags alphabetically every time you save. I understand that the order is un-important to the application... but it would really improve the revision-controlability at a low cost. (In my case I just removed all tags with regex from the file since I didn't really need them anyway.)
True, I see your point. I like the idea posted earlier by @otoomet about creating a metadata-file that contains user specific information (even template settings). This would be a great solution in my opinion. Addition: The metadata file could then either be gitignored or shared between users if current behavior is desired. |
For object tags, we want to preserve the insertion order, and it is reasonable to assume that the number of elements is low. This commit implements an interface similar to std::map (for insertion and lookup) on top of std::vector (for order and locality). With the change in the API, we also need to adjust the calling spots. Task: GH-1290 (VCS-friendly file format)
For object tags, we want to preserve the insertion order, and it is reasonable to assume that the number of elements is low. This commit implements an interface similar to std::map (for insertion and lookup) on top of std::vector (for order and locality). With the change in the API, we also need to adjust the calling spots. Task: GH-1290 (VCS-friendly file format)
For object tags, we want to preserve the insertion order in order to maintain a VCS-friendly file format. It is reasonable to assume that the number of tags per object is low. (In fact, it is zero for most objects unless imported from sources such as OSM.) This commit implements an interface similar to std::map (for insertion and lookup) for pairs of QString (key, value) on top of std::vector (for order and locality), and it adjusts all spots which access object tags. Task: GH-1290 (VCS-friendly file format)
For object tags, we want to preserve the insertion order in order to maintain a VCS-friendly file format. It is reasonable to assume that the number of tags per object is low. (In fact, it is zero for most objects unless imported from sources such as OSM.) This commit implements an interface similar to std::map (for insertion and lookup) for pairs of QString (key, value) on top of std::vector (for order and locality), and it adjusts all spots which access object tags. Task: GH-1290 (VCS-friendly file format)
Sorting everytime you save is too expensive. For now, I switched away from The new data structure is unit-tested, but I would appreciate if it could be complemented by some real-world testing of yesterday's master release. |
Ok so I've done some testing with git, branching, merging. There are two major things that are holding this back:
As a long term solution, I think that the idea of a multi-file format is not that bad. One such idea would be to store everything in a folder
(Qt has good json support and in our case it would drastically reduce the size as well as improve human readibility Qt docs) We could then gzip/bzip the folder into something like "Mymap.map" and teach OOM to open both the compressed folder and the uncompressed one from |
This attribute is not mandatory. It is used to pre-allocate memory in an informed way. With regard to versioning, this information might be moved to a sidecar file which is not under version control. If the file is missing or not consistent with the actual map file, there would be only a one-time performance impact.
It is not just colors. There are multiple spots where the current index in a list is used to refer to elements, instead of using a proper ID. I'm not sure if it will be really feasible to leave merging forked work only to I'm not willing to rush into a new/more complex format quickly. There are also other options to explore (for humans or revision control: YAML; binary: CBOR). In any case, we must be aware of the special case of loading and saving under memory/deadline pressure on Android. Updating few small files (only when modified) might even help, in contrast to updating a single big file. |
What I continue to trip over with JSON is its lacking tolerance for trailing comma. This is invalid:
Similar, when removing the whole |
That is a known limitation of JSON. One of multiple. Option is to use some superset of JSON, like JSON5 or YAML, which improves usability but notably reduces interoperability. |
However, the context of discussion is automagic merge in |
Why do you want to have json format, @jmacura ? From git perspective, xml is good enough (given formatting does not change). I agree that json is somewhat more human readable but I am not sure it matters in case of larger projects (like a map). |
Good point.
Actually, I am not the one who came up with JSON in this thread. |
Yeah I did mention JSON but it was no more than an idea:sweat_smile:. I actually proposed JSON (and for the matter YAML/TOML/XML) for other small things such as map metadata (undos, redos), an index file, symbols, colors, etc..., but that is definitely less important and depends a lot on Qt libraries avaliability, ease in parsing, git compatibility and is certainly one of the last things to worry about (if anyone is interested this is a good resource to read). In general at this point I think that the most sensible thing to do is to undersand wether creating a completely new format is worth the effort or if the current .omap/.xmap format is flexible enough to give good git compatibility. |
Thanks for clarification. IMO There are two separate goals with regard to revision control:
For the latter, I would suggest to start with a good research of existing open GIS formats, instead of re-inventing the wheel again. But probably most GIS simply follow a more centralized approach (central database), while |
Steps to reproduce
Actual behaviour
The file will be large, and apparently includes undo information, zoom level, view and such. Could not find a description of the file format.
Expected behaviour
Option to save only strictly map data (and preserve the order and formatting of objects saved). The undo/view information will interfere with RC systems, such as git and create a lot of spurious differences even when the actual map is not changed.
I would like to keep some of the maps under RC and keep the diffs as simple as possible. Ideally there will also be a some sort of graphical diff-merge tool (see #741) on top of the text-diffs.
Configuration
Mapper Version: 0.8.4
Operating System: ubuntu 16
The text was updated successfully, but these errors were encountered: