Difference between revisions of "Setting up walkyourplace"

From stgo
Jump to: navigation, search
(Install for Calgary)
(Install for Calgary)
Line 41: Line 41:
 
#** ToDo: check if it is possible to use "subprocess.Popen" or "Multiprocess" (see examples on stackoverflow and [http://stackoverflow.com/questions/3781851/run-a-python-script-from-another-python-script-passing-in-args here])
 
#** ToDo: check if it is possible to use "subprocess.Popen" or "Multiprocess" (see examples on stackoverflow and [http://stackoverflow.com/questions/3781851/run-a-python-script-from-another-python-script-passing-in-args 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???)
 
#* 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???)
# test ic Calgary works
+
# test if Calgary scenario works => see next part
#* this is how a request for the pedestrian network model for calgary looks like: <pre>GET call_wps.php?wps=pedestrian&start_point=51.05747321278561,-114.0794563293457&walking_time_period=15&walking_speed=1.38&distance_decay_function=false</pre>
+
== '''Testing Calgary scenario''' ==
#* this will do a call to the pedestrian-network '''crime WPS''' and return features in the given walkshed:  
+
# choosen params:
 +
#* pos lat = 51.05747321278561
 +
#* pos lon = -114.0794563293457
 +
#* 15 min walkshed
 +
#* walkspeed 1.38 m/sec
 +
# Then this is how the web browser client request for the pedestrian network model for calgary looks like: <pre>GET call_wps.php?wps=pedestrian&start_point=51.05747321278561,-114.0794563293457&walking_time_period=15&walking_speed=1.38&distance_decay_function=false</pre>
 +
# the subsequent call to the managment service would be: <pre>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</pre>
 +
#* '''Routing/OTP WPS''': this call will return the pedestrian walkshed as JSON object <pre>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</pre>
 +
#* '''Crime WPS''': for the same data and the pedestrian-network model we receive a list of crime features, with the following call:  
 
#** Calgary server <pre>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</pre>
 
#** Calgary server <pre>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</pre>
 
#** Stgo test server <pre>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]]]}</pre>
 
#** Stgo test server <pre>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]]]}</pre>

Revision as of 13:40, 8 April 2014

>> 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)
  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 (WPS, etc.) in file call_wps.php to http://146.155.17.113:17088/geoserver/
    • put in apache's /var/www/ (i.e. /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'});
      plus adding this to the layer selection plus as default layer (PS: also remove setting of the map bounds, see map.setMaxBounds(bounds);)
  3. get backend code
    • GeoServer WPS servers *.jar files = on 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. However, I am not having the sources right now, so the Walkshed request is send to the GISciencegroup 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 &.
        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
    • 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 be also be called using
        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]]]}

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