An example application of traffic-engine.
$ mvn clean compile assembly:single
- Grab a city extact, like https://s3.amazonaws.com/metro-extracts.mapzen.com/manila_phillipines.osm.pbf. Save it in $PROJECT_ROOT/data.
- Get yourself a CSV containing GPS records in the form
time,vehicle_id,lon,lat
. For example:2015-01-01 00:00:00.07018+08,43736,121.123456,14.123456
. Save it to $PROJECT_ROOT/data. You'll need about a million records before the results are any good. - Import the project to Eclipse.
- Edit the PBF_IN and CSV_IN fields in App.java to reflect your input PBF and CSV files.
- Run App.java
- A mapdb database (defined by the HISTOGRAM_DB field) will be written to disk.
- Open 'InspectHistogram.java'
- Edit the HISTOGRAM_FILENAME and CSV_OUT_FILENAME static variables.
- Run InspectHistogram.java
- A CSV with rows in the form (way_seg_id,mean_speed) will be written to disk.
- Open the shapefile output by App.csv in QGIS.
- Open the output speed CSV (defined by the CSV_OUT_FILENAME field) in QGIS. Specify that the CSV has no geometry.
- Open the properties of the shapefile in QGIS. Click the 'Joins' tab.
- Click the little green 'plus' button. The join field is 'waysegid' and the target field is 'name'.
- Click on the 'Style' tab. Select the 'Spectral' color ramp for the column "manila_speeds_mean". Use the 'Quantile' mode, with enough classes to show an even gradient. 30 works fine.
- Click 'OK'. The resulting image should be pretty.