Skip to content

Latest commit

 

History

History
77 lines (54 loc) · 2.16 KB

README.md

File metadata and controls

77 lines (54 loc) · 2.16 KB

vru-simulation

VRU SIMULATION SERVER AND WEB VIEW. Skeleton Go, HTML + Javascript with open street map ...

Install Golang on your computer https://golang.org/

 To run locally, build and run server.
 Enter localhost:8081 in your browser

Simple sequence GitHub Logo

The simulation tool should generate data in JSON format such as:

Example output

{
  "vru-simulation-data":{
    "name": "simdata-example",
    "simdata": [
      {
        "routename": "pastoria avenue",
        "gps": [{"lat": 37.386339,"long": -122.040848},{"lat":37.384997,"long":-122.034524}],
        "vrus": [{"type":"BIKE","number":5},{"type":"PEDESTRIAN","number":5}]
      },
      {
        "routename": "south pastoria avenue",
        "gps": [{"lat": 37.386239,"long": -122.30848},{"lat":37.382997,"long":-122.03433524}],
        "vrus": [{"type":"BIKE","number":2},{"type":"PEDESTRIAN","number":3}]
      }
    ]
  }

}

The json structure should be handled by the server and serve as input for the simulation tool. View the above JSON as an example which has room for improvement.

  • The json included a user identified name : "simdata-example" , useful for storage server side.
  • each route should have a user identified name : "routename":"pastoria avenue"
  • the gps coordinates for the route from A to B. "gps":["lat": 37.1111,"long": -122.111,...]
  • the various VRUS that will be simulated for that route: "vrus": [{"type":"BIKE","number":2},{"type":"PEDESTRIAN","number":3}]

The above examples have identified two road users(BIKE,PEDESTRIAN). We need to add more road users and name them accordingly.

For inspiration look at: https://docs.mapbox.com/api/navigation/#directions

Current example should let a user set a route from the hardcoded centre of the map.

    go build main.go
    ./main 

enter in your browser:

http://localhost:8082

To see the requestdata add a breakpoint in developer mode in the browser at row 48 and click on the map for a new route.

   map.getSource('route').setData(geojson)

inspect the geojson object and you will see all the geocoords for a new route. That will be used to build the json data above.