User:Frederik Ramm/Ideas for API 0.7

From OpenStreetMap Wiki
Jump to: navigation, search

Contents

Multi-Layer Capability

OSM doesn't have "layers" as such, but still we have many things that are relatively disjunct thematically. For example, someone who wants to edit the country's power grid will *not* want to download every single object in an area; he only wants the power lines and masts (and might use dimmed tiles in his editor as a background). The same goes for someone doing house number mapping - no need to bother him with tons of objects he is not going to touch anyway.

People might even want to map ancient roman roads - but someone editing today's city map does not want to be disturbed by them.

So, we need something like a tag filter to be applied when downloading stuff for a bbox. This is probably more difficult than it sounds at first because it will require the API to pass additional information like "this object is used by another object which you have not downloaded but trust me you cannot delete it and even moving it might upset things...".

Area Data Type

They're not dead unless you've seen the corpse.

Proper area data types would replace our current "multipolygon" relations plus lots of simple areas that we currently map using closed ways.

The advantage (over closed ways) would be that even without semantics (i.e. not looking at the tags) you could know whether something is just a closed line (e.g. a roundabout) or an area.

I've moved some of the stuff that was here to The Future of Areas.

Here is a nice quote from the mailing list that could serve as an illustration for anyone thinking about the problem:

I checked that the biggest lake polygon in the official Finnish mapping data has 287273 vertices, 5484 islands and the total length of this simple polygon is more that 5276 kilometers. It would be quite a beast as OSM multipolygon relation.

Moving to the Area Data Type

If you want any change in OSM, you not only have to describe (and possibly implement) what you want; you also have to think about a method of transition from the status quo to whatever it is that you would like to have.

So here's the (draft) plan:

For each multipolygon processed, open a new changeset with a suitable changeset comment. The changeset is an integral part of this procedure, it can be used to

t.b.d.: how to treat closed ways when migrating?

Issues

Relations with extended Roles

Perhaps we need a full set of tags for a relation member role (grammatical speaking, something like adverbs instead of adjectives). This would allow you to describe more precisely the way in which something is a member of something else.

A possible example is when relation membership is constrained in some way:

Say you have a bus stop, and two bus routes that serve the bus stop. One bus route serves it on Sundays only; the other serves it on weekdays only. Now where do you put that information. The bus stop is not a "Sunday only" bus stop - it is in use on all days. The bus routes #1 and #2 are not "Sunday only" bus routes - they operate throughout the week. It is just the membership of this bus stop in the route that is "Sunday only". You would like to somehow say: This object is member of this relation, but qualified by the following tags: "Sunday only".

In pseudo OSM XML, instead of this:

<relation id="1">
  <tag k="name" v="Bus route 1" />
  <tag k="note" v="Stops at node #2 only on Sundays!" />
  <member type="node" ref="1" role="stop" /> 
  <member type="node" ref="2" role="stop" /> 
  <member type="node" ref="3" role="stop" /> 
</relation>

you want this:

<relation id="1">
  <tag k="name" v="Bus route 1" />
  <member type="node" ref="1">
     <tag k="role" v="stop" />
  </member>
  <member type="node" ref="2" />
     <tag k="role" v="stop" />
     <tag k="operating_days" v="Sunday" />
  </member>
  <member type="node" ref="3">
     <tag k="role" v="stop" />
  </member>
</relation>

This is just one example; you might also want to add a "note" tag to a relation membership (not a note to the relation, and not a note to the object, but a note that explains why you made this object a member), or myriad other uses. Some people have abused the "role" property for this in the past, basically collapsing every bit of information that concerns the membership into that one role field, with some special character as a separator.

Symlinks and/or Diff storage on the database backend

It might make sense to allow the Rails API to refer back to previous versions. For example, if an object is created, then modified, and the change then reverted, we have an identical version 1 and 3 (apart from timestamp, author, changeset). If the object in question is a 500-node way then this means significant waste of storage. It would be cool if we could just store "version 3 is the same as version 1".

A more complex version of that is storing differences only: "version 3 has the same 500 nodes as version 2, but node 501 has been added at the end". The logical next step would be allowing real diff uploads, i.e. "dear API, please add this node to the end of way so-and-so but save me the hassle of uploading the whole way".

A lesser form of this idea is to at least make the API silently ignore update requests that would not actually change an object, returning the existing version number "n" (instead of "n+1").

Return Version Number with "Gone" Result

When you try to retrieve an object that has been deleted, you only get a "Gone" message but not the version number in which the deletion occurred. If you want to retrieve the last version before deletion, you currently have to load the full history which, especially for complex relations, can be very large. - Return version number with "Gone" so that people can access version n-1 easily.

Allow "if-modified-since" requests

Suppose I have a number of very large ways or relations and want to bring them up to date. Currently I'll have to retrieve them in full, unnecessarily straining API and bandwidth. It would be good to have a request that does "give my way #3456 but only if you have a higher version than 5 which is what I already have here".


t.b.c.

Personal tools
Namespaces
Variants
Actions
site
Toolbox