[OSM-dev] JSON-output for xapi

Matt Amos zerebubuth at gmail.com
Sun Jun 26 22:58:14 BST 2011


On Sun, Jun 26, 2011 at 6:17 PM, Ian Dees <ian.dees at gmail.com> wrote:
> I'm not sure it's specified anywhere, but it is customary (and many tools
> expect) to receive a sorted OSM file: nodes first, followed by ways,
> followed by relations. This makes constructing an in-memory model of the
> data easier on the client side.

indeed. the rails port generates XML with the nodes, ways and
relations in order and cgimap is designed to be compatible with that,
in both XML and JSON outputs. i figure it also makes parsing the data
easier, which is probably more important for JSON as the format is
often imported directly into working data structures in the browser.

have you considered using temporary tables in the database to order
the data so that it can be streamed? this is how cgimap (and, iirc,
jxapi?) solve the issue of building up search results in a performant
manner that can be streamed while also being correctly ordered.

cheers,

matt

> On Sun, Jun 26, 2011 at 12:05 PM, Dario Brandes <dalino at spline.de> wrote:
>>
>> hi matt,
>>
>> the main difference between our solutions is that you sort the data in
>> category's (nodes, ways, relations). We have only one list, in
>> which this elements are unsorted. This asynchronism is necessary to
>> keep our good server performance, because the output-module does not
>> have to await for all the data. It can start the output stream before.
>> What's your point of view? Do you really need this type of sorting?
>>
>> I hope we can find a solution, to make all happy :)
>>
>> Regards Dario
>>
>>
>> On Thu, 16 Jun 2011 19:22:54 +0100
>> Matt Amos <zerebubuth at gmail.com> wrote:
>>
>> > hi dario,
>> >
>> > there's experimental support in cgimap for JSON format, which will
>> > hopefully get enabled at 0.7 time (whenever that is). i've attached an
>> > example of the output in both JSON and XML for comparison. it looks
>> > extremely similar to the examples you've included below, so hopefully
>> > we can work together on this. :-)
>> >
>> > cheers,
>> >
>> > matt
>> >
>> > On Thu, Jun 16, 2011 at 5:04 PM, Dario Brandes <dalino at spline.de>
>> > wrote:
>> > > Hello everyone,
>> > >
>> > > we from the xappy.js Team want talk with you about a JSON Standard
>> > > for osm. The GeoJSON Format is inapt to safe relations and so we
>> > > created something new.
>> > > Here the link to our wikipage:
>> > > https://github.com/slomo/osm-spline-xapi/wiki/JSON-Output
>> > >
>> > > We would like to hear your comments about our proposal.
>> > >
>> > > Regards Dario
>> > >
>> > >
>> > >
>> > > # JSON output format definition by example.
>> > >
>> > > **Note:** for simple reading we included whitespaces which are of
>> > > course omitted in the actual implementation.
>> > >
>> > > ## skeleton
>> > >    {
>> > >        "version": 0.6,
>> > >        "generator": "xappy.js",
>> > >        "xapi": {
>> > >             "uri": "XXX",
>> > >             "planetDate": 201106161601,
>> > >             "copyright": "XXX",
>> > >             "instance": "XXX"
>> > >         },
>> > >        "elements": [
>> > >            ...
>> > >            ...
>> > >            ...
>> > >        ]
>> > >    }
>> > >
>> > > where the `elements` array obviously contains all the elements.
>> > >
>> > > ## node
>> > >    {
>> > >        "type": "node",
>> > >        "id": 3596186,
>> > >        "lat": 53.4633699598014,
>> > >        "lon": -2.22667910006381,
>> > >        "timestamp": "2007-06-21T17:10:58+01:00",
>> > >        "version": 2,
>> > >        "changeset": 2213,
>> > >        "tags": [
>> > >            "amenity": "hospital",
>> > >            "name": "Manchester Royal Infirmary"
>> > >        ]
>> > >    }
>> > >
>> > > ## way
>> > >    {
>> > >         "type": "way",
>> > >         "id": 4958218,
>> > >         "version": 3,
>> > >         "timestamp": "2007-07-25T01:55:35+01:00",
>> > >         "changeset": 2211,
>> > >         "nodes": [
>> > >             218963,
>> > >             331193
>> > >         ],
>> > >         "tags":[
>> > >             "landuse": "residential",
>> > >             "source": "landsat"
>> > >         ]
>> > >     }
>> > >
>> > > ## relation
>> > >    {
>> > >        "type": "relation",
>> > >        "id": 2670,
>> > >        "timestamp": "2007-10-25T03:05:34Z",
>> > >        "version": 32,
>> > >        "changeset": 2211,
>> > >        "members": [
>> > >            {
>> > >                "type":"way",
>> > >                "ref":3992472,
>> > >                "role": ""
>> > >            },
>> > >            {
>> > >                "type":"way",
>> > >                "ref":3992524,
>> > >            ],
>> > >        "tags":[
>> > >            "name": "Fonnereau Way",
>> > >            "network": "Ipswich foothpaths",
>> > >            "type": "route"
>> > >        ]
>> > >    }
>> > >
>> > > _______________________________________________
>> > > dev mailing list
>> > > dev at openstreetmap.org
>> > > http://lists.openstreetmap.org/listinfo/dev
>> > >
>> > >
>>
>> _______________________________________________
>> dev mailing list
>> dev at openstreetmap.org
>> http://lists.openstreetmap.org/listinfo/dev
>>
>
>



More information about the dev mailing list