Skip to content

Instantly share code, notes, and snippets.

@katiejots
Last active August 29, 2015 14:08
Show Gist options
  • Save katiejots/b379bb28cb5bdf22d1cd to your computer and use it in GitHub Desktop.
Save katiejots/b379bb28cb5bdf22d1cd to your computer and use it in GitHub Desktop.
OSDC OpenShift Tutorial

Installation

Finding Data

ogr2ogr -f GeoJSON data.json data.vrt

ogr2ogr -f GeoJSON data.json data.shp

VRT format:

<OGRVRTDataSource>
    <OGRVRTLayer name="NationalPublicToiletMap">
        <SrcDataSource>NationalPublicToiletMap.csv</SrcDataSource>
        <GeometryType>wkbPoint</GeometryType>
        <LayerSRS>WGS84</LayerSRS>
        <GeometryField encoding="PointFromColumns" x="Longitude" y="Latitude"/>
    </OGRVRTLayer>
</OGRVRTDataSource>

Setup

  • rhc setup
  • rhc app create myapp python-2.7 mongodb-2 --from-code=https://github.com/codemiller/cloud-craft-python-au.git -s
  • rhc app create myapp php-5.4 mongodb-2 --from-code=https://github.com/codemiller/cloud-craft-php.git -s
  • rhc app create myapp python-3.3 mongodb-2 --from-code=https://github.com/codemiller/cloud-craft-python.git -s

Importing Data

  • mongoimport -d myappname -c toilets --type json --file data.json
  • mongo myappname --eval 'db.toilets.ensureIndex( { "geometry.coordinates" : "2dsphere" } )'

Mongo commands:

  • show databases
  • use myappname
  • db.toilets.find()
  • db.toilets.getIndexes()

Test Locally

  • python app.py
  • php -S localhost:8080 -t static app.php

Push Changes to OpenShift

  • git status
  • git add --all
  • git commit -m "Commit message"
  • git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment