Skip to content

Commit

Permalink
Merge pull request fraunhoferfokus#2 from eue/master
Browse files Browse the repository at this point in the history
Kategorien-Zuordnungen von ISO191xx
Python-Hilfsfunktions zum Übertragen der Kategorien
  • Loading branch information
flowma committed Nov 19, 2012
2 parents da52054 + 2e8a813 commit 8437e14
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 0 deletions.
Empty file modified OGPD_JSON_Schema.html
100644 → 100755
Empty file.
Empty file modified OGPD_JSON_Schema.json
100644 → 100755
Empty file.
Empty file modified OGPD_JSON_Schema_changelog.txt
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified kategorien/berlin2deutschland.json
100644 → 100755
Empty file.
Empty file modified kategorien/bremen2deutschland.json
100644 → 100755
Empty file.
Empty file modified kategorien/deutschland.json
100644 → 100755
Empty file.
20 changes: 20 additions & 0 deletions kategorien/iso2deutschland.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"farming": ["wirtschaft_arbeit"],
"biota": ["umwelt_klima"],
"boundaries": ["geografie"],
"climatologyMeteorologyAtmosphere": ["umwelt_klima"],
"economy": ["wirtschaft_arbeit"],
"elevation": ["geo"],
"environment": ["umwelt_klima"],
"geoscientificInformation": ["geo"],
"health": ["gesundheit"],
"imageryBaseMapsEarthCover": ["geo"],
"location": ["geografie"],
"oceans": ["geo"],
"planningCadastre": ["geografie"],
"society": ["Demographie"],
"structure": ["stadtplanung"],
"transportation": ["transport_verkehr"],
"utilitiesCommunication": ["infrastruktur_bauen_wohnen"],
"inlandWaters": ["geo"]
}
34 changes: 34 additions & 0 deletions lib/groupmap.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import json, urllib2

class Util:

def translate(self, categories, sourceportal):
url = "https://github.com/fraunhoferfokus/ogd-metadata/raw/master/kategorien/" + sourceportal + "2deutschland.json"
map = json.loads( urllib2.urlopen(url).read())
out = []
for cat in categories:
if cat in map.keys():
out = out + map[cat]
return out


import unittest
class TestMapping(unittest.TestCase):


def test_b2d(self):
u = Util()
translated = u.translate(['verkehr','wahl'], 'berlin')
print translated
self.assertEqual(translated, ['transport_verkehr','politik_wahlen'])

def test_missing(self):
u = Util()
translated = u.translate(['verkehr','xyz','wahl'], 'berlin')
print translated
self.assertEqual(translated, ['transport_verkehr','politik_wahlen'])


if __name__ == '__main__':
unittest.main()

Empty file modified lizenzen/deutschland.json
100644 → 100755
Empty file.
Empty file modified validation/validate.js
100644 → 100755
Empty file.

0 comments on commit 8437e14

Please sign in to comment.