slides/map/import-script-exercise.xml
Exercise #1: The script
27/104
The import script
Exercise #2: Querying
  • • git clone git://github.com/derickr/mongo-workshop.git
  • • cd mongo-workshop && git checkout import1
  • • Edit import-data.php to create the document structure at #1:
  • • Cast all values, due to SimpleXML weirdness
  • • _id needs to be "n" + the node's ID (in $node['id'])
  • • type is 1 for nodes
  • • Make sure to add the location (lon, lat) as a two element array in the loc element.
  • • Edit import-data.php to create the document structure at #3:
  • • _id needs to be "w" + the node's ID (in $way['id'])
  • • type is 2 for ways
  • • Add the insert statement at #2 and #4
  • • Run the script: php import-data.php compress.zlib://antwerp.xml.gz