User talk:H4ck3rm1k3/TagOntology

From OpenStreetMap Wiki
Jump to navigation Jump to search

How to update

   perl schema.pl > data.wiki ## generate a new wiki from the google doc
   git diff                   ## look at the diffs
   git commit -m "update" -a  ## commit them
   git push origin master     ## push 

About

This tool is to take the list of map features that sam has been compiling and be able to transform them into something new. in the process, I learned a bit about google spreadsheets. Amazing that they have such a verbose data format, the data is expanded about 10x bigger than any csv format, and you can get a feed for each cell. Anyway, I now have a perl script that will pull and parse this XML atom data feed of the spreadsheet. It creates currently a set of template instances which expand into some ugly html. That can be fixed without programming by changing the wiki template. If you want to generate different code, you can also do that without programming using the template toolkit! so it is easy for n00bs to use.

The plan is to create an XML schema, a stylesheet, sql tables and a rdf ontology based on this table, of course we need to understand it first.

See the resulting data here User:H4ck3rm1k3/TagOntology

See the template here how the html was produced http://wiki.openstreetmap.org/wiki/Template:TagMap

The source code is here: http://gitorious.org/~h4ck3rm1k3/wikimap-books/h4ck3rm1k3s-wikimap-books-legend/blobs/master/schema.pl

The program downloads the xml from google docs and transforms it. http://spreadsheets.google.com/feeds/cells/0Am70fsptsPF2dENGRWNOQ3lmeU5UbWlORFZTZFpvRWc/od6/public/basic

Optionally you can pass it a file, so without any parameters, it will download the file, otherwise it will use the given file.

I have checked in the example xml here : http://gitorious.org/~h4ck3rm1k3/wikimap-books/h4ck3rm1k3s-wikimap-books-legend/blobs/raw/5f1c5bdc71414af3184a4d07ed0864c546755781/data.xml

And example of the output is here: http://gitorious.org/~h4ck3rm1k3/wikimap-books/h4ck3rm1k3s-wikimap-books-legend/blobs/master/data.wiki


The template used is here : http://gitorious.org/~h4ck3rm1k3/wikimap-books/h4ck3rm1k3s-wikimap-books-legend/blobs/master/templates/Wiki.tt

The fields of the sheet are :

  • GeoNamesCode
  • GarminID
  • GarminFeatureDescription
  • KEY
  • VALUE
  • Group
  • Code
  • Feature
  • Description
  • Comments

The generated code can be modified using the template toolkit : http://template-toolkit.org/