Difference between revisions of "Setting up walkyourplace"

From stgo
Jump to: navigation, search
(Install for Calgary)
(Modify code for Santiago)
Line 84: Line 84:
 
#* GeoServer WPS location (IP/address)  
 
#* GeoServer WPS location (IP/address)  
 
#* Postgres location and access: ''postgis.conf''
 
#* Postgres location and access: ''postgis.conf''
#* Tileserver location/code in client
+
#* change Tileserver location/code in client or use MapQuest/OSM for background map tiles
#* OTP location in backend (jar file)
+
#* change OTP location on backend and toPlace coordinates:
#* remove crime calculation in ''ManagementService.py''
+
#** Walkshed_Pedestrian_Centralized.java / Bikeshed_Centralized.java (-> create new jar file)
 +
#** AggregationService.py
 +
#* perhaps remove crime calculation in ''ManagementService.py''
 
# deploy code:
 
# deploy code:
 
#* client side code => install on var/www/ of apache server
 
#* client side code => install on var/www/ of apache server

Revision as of 17:14, 14 August 2015

>> return to Cedeus IDE


Steps to Install the WalkYourPlace tool for Santiago.

The current instance is accessible under http://146.155.17.19:17080/wypwps/

General prep steps

  1. create new Ubuntu 12.04 VM with LA(M)PS ( 7773, cedeusgeonode: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.19:30088) - 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.19: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 or a single file for all (made recently by EP) => install in GeoServers */WEB-INF/lib folder (which may be located under /var/lib/tomcat7/webapps/geoserver/...) => restart GeoServer
      • check if it works with http://146.155.17.19:17088/geoserver/ows?service=wps&version=1.0.0&request=GetCapabilities
      • then search for the following WPS entries (the names for V2 changed, including the term "centralized)":
        • gs:Aggregate, gs:Aggregation_Bike, gs:Aggregation_Pedestrian, gs:Aggregation_Transit,
        • gs:Aggregation_WS, gs:Aggregation_WYP, gs:Aggregation_WY
        • gs:Bikeshed, gs:Walkshed_Pedestrian, gs:Walkshed_Transit
        • gs:Crime_Bike, gs:Crime_Pedestrian, gs:Crime_Transit, gs:Crime_WYP
        • gs:Management_Bike, gs:Management_Pedestrian, gs:Management_Transit,
        • gs:Management_WS, gs:Management_WYP
        • gs:POI_Bike, gs:POI_Pedestrian, gs:POI_Transit
        • gs:POI_WS, gs:POI_WYP,
        • gs:Transit, gs:Union
    • GeoProcessing Engine (access model code in Python) => put in any folder (e.g. /home/ssteinig/wypmodels/)
      e.g. the Pedestrian Network code is now under /home/ssteinig/wypmodels/Network-PedestrianOnly/
    • modify the postgres DB access in postgis.conf (host IP, port, db, login, etc.)
    • next 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 because I get an error at the moment as I am not having gnome-terminal available via command line. Hence, 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.

(for testing of walkshed calculation use http://146.155.17.18:30088/pyp-walkshed-client/

    • 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
    • client/js/main.js
      • modify map_center LatLng coordinates from Calgary to Santiago
      • add OpenStreetMap tile layer (see code line above) and activate as default - so we see actuall a map of Santiago
    • GeoServer WPS location (IP/address)
    • Postgres location and access: postgis.conf
    • change Tileserver location/code in client or use MapQuest/OSM for background map tiles
    • change OTP location on backend and toPlace coordinates:
      • Walkshed_Pedestrian_Centralized.java / Bikeshed_Centralized.java (-> create new jar file)
      • AggregationService.py
    • perhaps 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
    • Test position: lat_stgo = -33.426033 , lon_stgo = -70.602804
    • Test walkshed: walkshed = '{"type":"Polygon","coordinates":[[[-70.61385721469895,-33.42850272750062],[-70.61356058839867,-33.42798359634024],[-70.61166719271597,-33.424376104229665],[-70.61149124381222,-33.42287365565667],[-70.61147936570502,-33.422769669950966],[-70.61058034229507,-33.420920833612726],[-70.60923160172507,-33.417698238606526],[-70.60613267402977,-33.41653969373451],[-70.60437449601663,-33.41620583088737],[-70.60030327178143,-33.41791372437482],[-70.59803167295307,-33.41932217260385],[-70.5947452603848,-33.42089947313322],[-70.59156549154828,-33.42329525340425],[-70.5909228581005,-33.42413497204158],[-70.59144108932382,-33.42607438097505],[-70.59349562786792,-33.428834396229],[-70.59643931216023,-33.43259656603248],[-70.59747457131638,-33.43394922819952],[-70.59901486695664,-33.435784475786605],[-70.60099188713762,-33.43629105037291],[-70.60509364804035,-33.43430330941572],[-70.6057986466706,-33.43396166890046],[-70.60799109097594,-33.43291457173286],[-70.61016518642498,-33.43161181061516],[-70.61278409214731,-33.43061447386348],[-70.61385721469895,-33.42850272750062]]]}'
    • Request for Santiago location as it would be send by the client:
      http://146.155.17.113:17080/wypwps/call_wps.php?wps=pedestrian&start_point=-33.426,-70.602&walking_time_period=15&walking_speed=1.38&distance_decay_function=false