OpenStreetMap

Object-oriented mapping?

Posted by ThePromenader on 14 April 2011 in English.

OSM's learning curve is long indeed - its documentation is too disperse and hard to find (you have to know what you are looking for (wiki) before you can find it), but once you've grasped the basic understanding of how OSM works (mapping and tagging methods), things become pretty straightforward. I'm almost there now.

What most confused me in my reading/experimentation was the "relation" - it is used to describe both shape and association. Perhaps it is my using JOSM that helped in my confusion, but seeing a list of 'relations' consisting of unnamed multipolygons and all metro stations 'related' to the path of the metro line crossing the wee patch of land I was working on was indeed confusing - what is the use of a list if we don't know what those objects ~are~ ? Furthermore, keys (describing the point/way(/polygon)) seem to take secondary priority over the shape itself - In all logic, shouldn't it be the other way around? I think this is the hurdle that takes new users the longest to get over, and is the main cause of the disparity in placement methods of 'key' data. If I can cite a recent example, from my work on the city of Paris (France), contributors there added the "building" key to the "outer" polygon in a sometimes multipolygon, but not to the other multipolygon members, or the multipolygon itself: this means that someone rendering OSM data through his own methods would have to search the OSM data for a) a 'master' multipolygon, and if there is one, b) all polygon members of that multipolygon.

Even that didn't work out for me in some cases: contributors would sometimes make a building an "inner" polygon in a, for example, garden multipolygon: when I used the above method to try to make a comprehensive 'building' polygon, the result was the building being but a hole in the garden multipolygon.

Everything in a map is an object. A building, a tree, a patch of grass, an address - each has its own quality as far as data is concerned (a tree may be a node with a custom icon, a building could be a polygon or multipolygon, an address could be a node with a custom tag), but the form of the object should be ~secondary~ to its role, not the opposite!

Say I wanted to create a new object - a building, for example. In a 'new object' dialog, I would enter 'building', and perhaps any information about that building (owner, construction date, address, etc), then I would begin to draw it. The shape could be a polygon, a multipolygon, or a simple way (to imagine a 'glass wall' extreme case) - but this wouldn't matter! The shape, whatever form it has, would be connected to its 'parent object' through an id number. I know that this is just another way of repeating the OSM documentation "add keys to the multipolygon itself, not a member polygon", but presented this way it is much more comprehensive to the end user.

Yet a roadblock to implementing this method is OSM's method of storing data between 'nodes', 'ways' and 'relations'. I understand totally this schema from a data point of view, but this shouldn't even be visible to the end-user or contributor; for the time being key data can be attributed to ~any~ node, way or relation, and the data schema not only makes this disparity possible, but it promotes it.

Instead, what about an additional "object" element, one that would contain all the keys pertaining to that object (that would have its own id)? Each object's nodes, ways and members could still be distributed using OSM's existing methods (if the object's form was a polygon, the object's id would be associated with a 'way' line (itself having an id); were it a multipolygon, the object id number would be associated with a relation (itself having an id), then to member ways, then to way nodes... business as usual, what. I know that this 'object' is just an extra level on top of OSM's existing methods, but it would group all the keys under one 'data type', most probably making searches much faster (and fruitful), and possibly making it possible to divide data the data parsing workload between search and rendering engines. But most of all, I think this would make things much clearer and simpler for the end user!

Discussion

Comment from EdLoach on 14 April 2011 at 07:15

Documentation shouldn't be too hard to find as there is a big "Documentation" link on the left of this page. I'm not sure I follow the detail of the rest of your diary entry, but relations are often used when they aren't needed (why would a building need to be a multi-polygon if it doesn't have a hole in it) or completely abused (see the wiki page about relations are not categories).

Comment from Strash on 14 April 2011 at 07:32

> "why would a building need to be a multi-polygon if it doesn't have a hole in it"
That's what he meant : from a database point of view it make sense to distinguish multi-polygon, way, etc... but from a user perspective a building should be a building, the software should be able to create a way or a polygon depending on the case.

Comment from Richard on 14 April 2011 at 08:38

Basically multipolygons-in-relations are a horrible hack. Hopefully API 0.7 will move them into an area datatype, and let relations resume the 'association' role alone.

Comment from Vincent de Phily on 14 April 2011 at 13:12

I think the current data format (3 element types, each taggable) is sound : both simple and powerfull. It lets you describe any kind of real-world object. To me, ThePromenader's "object" element sounds like an unnecessary indirection : why have an extra element for tagging when you can tag the other elements directly ? Also, there are plenty of use-cases for tagging a contained element with one value, and the container element with another value.

While the format is good, I agree that it's too easy to misuse it. But that's something that should be fixed in the editor workflow, not the underlying format. Maybe deciding on the tags before drawing the element instead of the other way around, like ThePromenader suggests, is a step in the good direction. But please don't dump things down to the point of inflexibility. For that matter, it is very good that we have different editors avaible, with different philosophies.

Comment from ThePromenader on 14 April 2011 at 16:58

Thanks for the input, Vincent, I see your point - but you hit the nail on the head and get to the gist of my argument in your phrase "real-world object". If you think the object you are creating is worthy of having tags added to to it, an additional 'object' key provides that place ~no matter what form that object has~. In the present system, I have to add keys ~somewhere in the shape~ of the actual physical object I am trying to add - but the ~form~ of what I am adding should be secondary. To simplify, first ask "what role does what I'm adding to this map play in this map", then tell "what form does it have?". Sheesh, I just summarized my entire long-winded post in ~20 words.

Log in to leave a comment