Xappy.js

From OpenStreetMap Wiki
Jump to: navigation, search
Available languages — Xappy.js
Afrikaans Alemannisch aragonés asturianu azərbaycanca Bahasa Indonesia Bahasa Melayu Bân-lâm-gú Basa Jawa Baso Minangkabau bosanski brezhoneg català čeština dansk Deutsch eesti English español Esperanto estremeñu euskara français Frysk Gaeilge Gàidhlig galego Hausa hrvatski Igbo interlingua Interlingue isiXhosa isiZulu íslenska italiano Kiswahili Kreyòl ayisyen kréyòl gwadloupéyen kurdî latviešu Lëtzebuergesch lietuvių magyar Malagasy Malti Nederlands Nedersaksies norsk norsk nynorsk occitan Oromoo oʻzbekcha/ўзбекча Plattdüütsch polski português română shqip slovenčina slovenščina Soomaaliga suomi svenska Tiếng Việt Türkçe Vahcuengh vèneto Wolof Yorùbá Zazaki српски / srpski беларуская български қазақша македонски монгол русский тоҷикӣ українська Ελληνικά Հայերեն ქართული नेपाली मराठी हिन्दी অসমীয়া বাংলা ਪੰਜਾਬੀ ગુજરાતી ଓଡ଼ିଆ தமிழ் తెలుగు ಕನ್ನಡ മലയാളം සිංහල ไทย မြန်မာဘာသာ ລາວ ភាសាខ្មែរ ⵜⴰⵎⴰⵣⵉⵖⵜ አማርኛ 한국어 日本語 中文(简体)‎ 吴语 粵語 中文(繁體)‎ ייִדיש עברית اردو العربية پښتو سنڌي فارسی ދިވެހިބަސް

Xappy.js is a reimplementation of the OSM XAPI in node.js (Java Script). Currently using Postgres and the PostGIS extension with the option to implement other backends. For further information please take a look at the docs on github.

Code on github (also docs)


JSON output

Xappy.js offers JSON formatted output. It has been suggested that this could be a features added to other XAPI implementations

skeleton

    {
        "version": 0.6,
        "generator": "xappy.js",
        "xapi": {
             "planetDate": 201106161601,
             "copyright": "XXX"
        },
        "elements": [
            ...
            ...
            ...
        ]
    }

Where the `elements` array obviously contains all the elements. We do not order the elements into different groups, since this matches more the xml-output approch. We also heard myths that xml elements should be sorted too. But with openlayer we had no problem using unsorted xml, so we stick to it in JSON. Also there was no information on such an informal definition.

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, 
                "role": ""
            }
        ...
      ],
        "tags":[
            "name": "Fonnereau Way",
            "network": "Ipswich foothpaths",
            "type": "route"
        ]
    }