Setting up walkyourplace

From stgo
Revision as of 16:31, 21 April 2014 by Mentaer (Talk | contribs)

Jump to: navigation, search

>> return to Cedeus IDE


Steps to Install the WalkYourPlace tool for Santiago

General prep steps

  1. create new Ubuntu 12.04 VM with LA(M)PS ( 7773, lautaro:17022)
    • when using an existing VM image :
      • fix network issue (remove old card settings in /etc/udev/rules.d/70-persistent-net.rules and reboot)
      • set new machine name (in /etc/hostname)
      • check if apache2 starts with an error message or not (for a fix see Setting up geonode > Basic Install for GeoNode v. 2.0)
  2. install tomcat 7 (or jetty)
  3. install GeoServer + WPS plugin
  4. install Php cURL (http://php.net/curl)
    • geoserver should run on port 8080, otherwise modify "call_wps.php".
  5. install OpenTripPlanner (running on GeoNode VM (146.155.17.54:8080) - and compile graph with
    • Santiago OSM data
    • Santiago GTFS data
    • => test if it works
  6. install PostgreSQL + PostGIS (17032 : db: wypdb)
    • install PostgreSQL

Install for Calgary

  1. Install DBs
    • install crime DB (for the crimes, we considered 12 types of crime as listed in http://crimemap.calgarypolice.ca/ : weighing is in AggregationService.py)
    • install GTFS DB
  2. get Browser client code "WPSClient"
    • modify browser client end-point IP (WPS, etc.) in file call_wps.php to http://146.155.17.113:17088/geoserver/
    • put client app in Apache's /var/www/ (e.g.: /var/www/wypwps)
    • note: the map tiles, as defined in js/main.js, will still come from http://136.159.122.90/PHPTileServer/CalgaryGrey/{z}/{x}/{y}.png However, in case the TileServer is down its possible to add OSM map with
      var osmmap = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors'});
      add this layer to the layer selection and set as default layer (PS: also remove setting of the map bounds, see map.setMaxBounds(bounds);)
  3. get back-end code
    • GeoServer WPS servers *.jar files = one for each model => install in GeoServers */WEB-INF/lib folder => restart GeoServer
    • GeoProcessing Engine (access model code in Python) => put in any folder
    • modify the postgres DB access in postgis.conf
    • next I would also need modify the OpenTripPlaner URL in in the jar of the WPS module = model. If not modified the Walkshed request is send to the GISciencegroup OTP server.
    • install "psycopg2" python modul which allows access to PostgrSQL: pip install psycopg2 (for that, install before "python-dev" and "libpq-dev")
    • start each model with "run.py"
      • it may be necessary to change run.py (causes error at the moment) since I am not having gnome-terminal available via command line. At the moment I am starting the scripts using commandline python xxx.py &. Attention, the CrimeService.py and AggregationService.py script needs to be started from within its folder, otherwise config.py will not find the postgis.conf file (working directory issue).
        1. the Management Service (for pedestrian network) will listen on http://0.0.0.0:8363/
        2. the Crime Service will listen on http://0.0.0.0:8366/
        3. the Aggregation Service will listen on http://0.0.0.0:8364/
        4. the POI Service will listen on http://0.0.0.0:8365/
      • My running processes I can see then with ps -u ssteinig
      • ToDo: check if it is possible to use "subprocess.Popen" or "Multiprocess" (see examples on stackoverflow and here)
    • Note, not sure, but in ManagementService.py the GeoServer URL is defined with http://127.0.0.1:8080/geoserver - maybe this needs to be changed (for use in a VM???)
  4. test if Calgary scenario works => see next part

Testing Calgary scenario

  1. choosen params:
    • pos lat = 51.05747321278561
    • pos lon = -114.0794563293457
    • 15 min walkshed
    • walkspeed 1.38 m/sec
  2. Then this is how the web browser client request for the pedestrian network model for calgary looks like:
    GET call_wps.php?wps=pedestrian&start_point=51.05747321278561,-114.0794563293457&walking_time_period=15&walking_speed=1.38&distance_decay_function=false
  3. the subsequent call to the managment service would be:
    http://146.155.17.113:17088/geoserver/ows?service=wps&version=1.0.0&request=Execute&Version=1.0.0&Identifier=gs:Management&DataInputs=StartPoint=51.0574732128,-114.079456329;WalkingTimePeriod=15;WalkingSpeed=1.38
    • Routing/OTP WPS: this call will return the pedestrian walkshed as JSON object
      http://146.155.17.113:17088/geoserver/ows?service=wps&version=1.0.0&request=execute&identifier=gs:Walkshed_Pedestrian&datainputs=StartPoint=51.0574732128,-114.079456329;WalkingPeriod=15;WalkingSpeed=1.38;WalkshedOutput=SHED
      Note, that at the moment (8. April 2014) this will re-route the request to the Calgary OTP server.
    • Crime WPS: for the same data and the pedestrian-network model we receive a list of crime features, with the following call:
      • Calgary server
        http://136.159.122.90:8080/geoserver/ows?service=wps&version=1.0.0&request=execute&identifier=gs:Crime_Pedestrian&datainputs=Walkshed=%7B%22type%22:%22Polygon%22,%22coordinates%22:%5B%5B%5B-114.09364571378056,51.057144582993836%5D,%5B-114.09286815708892,51.05359381755474%5D,%5B-114.09101115708,51.050834058520664%5D,%5B-114.09075927937053,51.05080998647081%5D,%5B-114.0870286,51.0516827%5D,%5B-114.08586777200182,51.04970977429437%5D,%5B-114.0835059,51.0489783%5D,%5B-114.08184778623112,51.0498709384076%5D,%5B-114.081181,51.0536508%5D,%5B-114.0793914,51.0547065%5D,%5B-114.077687,51.0557314%5D,%5B-114.0756248,51.0568823%5D,%5B-114.0750158,51.0570965%5D,%5B-114.0736901,51.0573512%5D,%5B-114.06926177015508,51.055915080229724%5D,%5B-114.06619893997784,51.05694155563417%5D,%5B-114.06579011626843,51.0581622658825%5D,%5B-114.067673398873,51.058916548778726%5D,%5B-114.07143185670641,51.061423362491404%5D,%5B-114.07184987616904,51.06168921938163%5D,%5B-114.0741837,51.0613545%5D,%5B-114.07794224224338,51.06228401160695%5D,%5B-114.07918450576179,51.06260346516831%5D,%5B-114.07993046849634,51.06280359284396%5D,%5B-114.08066137191179,51.062350982627464%5D,%5B-114.08244401432806,51.06127600012983%5D,%5B-114.08582266933304,51.061346817139835%5D,%5B-114.08616082731021,51.06129711945887%5D,%5B-114.0888935,51.0575163%5D,%5B-114.09170271289915,51.05843118482227%5D,%5B-114.09364571378056,51.057144582993836%5D%5D%5D%7D
      • Stgo test server
        http://146.155.17.113:17088/geoserver/ows?service=wps&version=1.0.0&request=execute&identifier=gs:Crime_Pedestrian&datainputs=Walkshed={%22type%22:%22Polygon%22,%22coordinates%22:[[[-114.09364571378056,51.057144582993836],[-114.09286815708892,51.05359381755474],[-114.09101115708,51.050834058520664],[-114.09075927937053,51.05080998647081],[-114.0870286,51.0516827],[-114.08586777200182,51.04970977429437],[-114.0835059,51.0489783],[-114.08184778623112,51.0498709384076],[-114.081181,51.0536508],[-114.0793914,51.0547065],[-114.077687,51.0557314],[-114.0756248,51.0568823],[-114.0750158,51.0570965],[-114.0736901,51.0573512],[-114.06926177015508,51.055915080229724],[-114.06619893997784,51.05694155563417],[-114.06579011626843,51.0581622658825],[-114.067673398873,51.058916548778726],[-114.07143185670641,51.061423362491404],[-114.07184987616904,51.06168921938163],[-114.0741837,51.0613545],[-114.07794224224338,51.06228401160695],[-114.07918450576179,51.06260346516831],[-114.07993046849634,51.06280359284396],[-114.08066137191179,51.062350982627464],[-114.08244401432806,51.06127600012983],[-114.08582266933304,51.061346817139835],[-114.08616082731021,51.06129711945887],[-114.0888935,51.0575163],[-114.09170271289915,51.05843118482227],[-114.09364571378056,51.057144582993836]]]}
      • if the python server/script is started, the crime data can also be retrieved using the following from the machines web browser itself (I think so...):
        http://127.0.0.1:8366/crime?walkshed={%22type%22:%22Polygon%22,%22coordinates%22:[[[-114.09364571378056,51.057144582993836],[-114.09286815708892,51.05359381755474],[-114.09101115708,51.050834058520664],[-114.09075927937053,51.05080998647081],[-114.0870286,51.0516827],[-114.08586777200182,51.04970977429437],[-114.0835059,51.0489783],[-114.08184778623112,51.0498709384076],[-114.081181,51.0536508],[-114.0793914,51.0547065],[-114.077687,51.0557314],[-114.0756248,51.0568823],[-114.0750158,51.0570965],[-114.0736901,51.0573512],[-114.06926177015508,51.055915080229724],[-114.06619893997784,51.05694155563417],[-114.06579011626843,51.0581622658825],[-114.067673398873,51.058916548778726],[-114.07143185670641,51.061423362491404],[-114.07184987616904,51.06168921938163],[-114.0741837,51.0613545],[-114.07794224224338,51.06228401160695],[-114.07918450576179,51.06260346516831],[-114.07993046849634,51.06280359284396],[-114.08066137191179,51.062350982627464],[-114.08244401432806,51.06127600012983],[-114.08582266933304,51.061346817139835],[-114.08616082731021,51.06129711945887],[-114.0888935,51.0575163],[-114.09170271289915,51.05843118482227],[-114.09364571378056,51.057144582993836]]]}
    • POI WPS : for the following call to my Stgo Server and by using a Calgary walkshed, we receive a list of POIs (raw about 1085 POIs):
      http://146.155.17.113:17088/geoserver/ows?service=wps&version=1.0.0&request=execute&identifier=gs:POI_Pedestrian&datainputs=Walkshed={%22type%22:%22Polygon%22,%22coordinates%22:[[[-114.09364571378056,51.057144582993836],[-114.09286815708892,51.05359381755474],[-114.09101115708,51.050834058520664],[-114.09075927937053,51.05080998647081],[-114.0870286,51.0516827],[-114.08586777200182,51.04970977429437],[-114.0835059,51.0489783],[-114.08184778623112,51.0498709384076],[-114.081181,51.0536508],[-114.0793914,51.0547065],[-114.077687,51.0557314],[-114.0756248,51.0568823],[-114.0750158,51.0570965],[-114.0736901,51.0573512],[-114.06926177015508,51.055915080229724],[-114.06619893997784,51.05694155563417],[-114.06579011626843,51.0581622658825],[-114.067673398873,51.058916548778726],[-114.07143185670641,51.061423362491404],[-114.07184987616904,51.06168921938163],[-114.0741837,51.0613545],[-114.07794224224338,51.06228401160695],[-114.07918450576179,51.06260346516831],[-114.07993046849634,51.06280359284396],[-114.08066137191179,51.062350982627464],[-114.08244401432806,51.06127600012983],[-114.08582266933304,51.061346817139835],[-114.08616082731021,51.06129711945887],[-114.0888935,51.0575163],[-114.09170271289915,51.05843118482227],[-114.09364571378056,51.057144582993836]]]}
      • the direct request to MapQuest's Search API would look like this (limited to 10 results):
        http://www.mapquestapi.com/search/v2/polygon?key=Fmjtd%7Cluuan90bnh%2C8w%3Do5-96r5l4&callback=renderBasicSearchNarrative&maxMatches=10&outFormat=json&polygon=51.057144583,-114.093645714,51.0535938176,-114.092868157,51.0508340585,-114.091011157,51.0508099865,-114.090759279,51.0516827,-114.0870286,51.0497097743,-114.085867772,51.0489783,-114.0835059,51.0498709384,-114.081847786,51.0536508,-114.081181,51.0547065,-114.0793914,51.0557314,-114.077687,51.0568823,-114.0756248,51.0570965,-114.0750158,51.0573512,-114.0736901,51.0559150802,-114.06926177,51.0569415556,-114.06619894,51.0581622659,-114.065790116,51.0589165488,-114.067673399,51.0614233625,-114.071431857,51.0616892194,-114.071849876,51.0613545,-114.0741837,51.0622840116,-114.077942242,51.0626034652,-114.079184506,51.0628035928,-114.079930468,51.0623509826,-114.080661372,51.0612760001,-114.082444014,51.0613468171,-114.085822669,51.0612971195,-114.086160827,51.0575163,-114.0888935,51.0584311848,-114.091702713,51.057144583,-114.093645714

Modify code for Santiago

  1. install PyCharm to modify client code and backend code
    • GeoServer WPS location (IP/address)
    • Postgres location and access: postgis.conf
    • Tileserver location/code in client
    • OTP location in backend (jar file)
    • remove crime calculation in ManagementService.py
  2. deploy code:
    • client side code => install on var/www/ of apache server
    • if there are no changes: GeoProcessing Engine(s) => put in whatever folder and run "run.py"
    • GeoServer WPS servers *.jar files => put in GeoServers */WEB-INF/lib folder (requires restart of GeoServer)
  3. Test