Currently Under Development
The VicRoads Transport Open Data API is a new service under active development. As such it may be subject to changes, outages and data issues.
Welcome to the VicRoads Transport Open Data API. This API provides near real time access to popular VicRoads transport datasets in OGC Standard formats (WMS and WFS). The current datasets include:

To get started with the API you will first need to request an API Token from traffic_requests@vicroads.vic.gov.au. In the e-mail please include the subject "API Token Request" and provide the following details within the body of the e-mail:

API tokens are used so that we can track usage of the API, and can be revoked in the event of misuse. Once you have a token it must be included in every request in one of two ways:

Request throttling is also applied to manage load on the servers. When requests exceed the throttling limits a '503 Service Unavailable' error will be returned.

The available datasets are loaded on a 1 minute cycle, however this is dependent on a variety of upstream systems so generally data will be a few minutes old. Data is loaded and served as-is from the source (no additional processing or formatting is applied other than converting to the requested format).

All datasets are made available via OGC Standard services:

Available datasets and sample queries are included in the following sections.


vicroads:erc_point

Emergency Road Closure Points


vicroads:erc_line

Emergency Road Closure Lines


vicroads:bluetooth_sites

Bluetooth Congestion for Intersection Sites (Points)


vicroads:bluetooth_links

Bluetooth Congestion for Road Segments (Links)


vicroads:variable_speed_signs

Lane Use Management System Variable Speed Signs (Points)



WMS Endpoint

Comprehensive WMS documentation is available on the Geoserver site. The most common type of WMS request is a GetMap request for a map image which can be structured as follows:
http://api.vicroads.vic.gov.au/vicroads/wms?
    service=WMS&
    version=1.1.1&    - 1.1.1 or 1.3.0 are most widely used
    request=GetMap&
    layers=vicroads:bluetooth_links&    - Layer name, separate multiple with comma
    styles=red_point&     - Optional named style on server, or can use 'sld_body' to pass custom SLD style
    srs=EPSG:4326&
    bbox=144.87,-38.64,145.64,-37.71&   - Bounding box of output image
    cql_filter=congestion>5&    - Optional attribute or spatial filter using CQL
    width=780&
    height=330&
    format=image/png&   - Output image format


WMS Request - Get Capabilities:

http://api.vicroads.vic.gov.au/vicroads/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities&AUTH=%INSERT_TOKEN%


WMS Request - Get Map by Bounding Box:

http://api.vicroads.vic.gov.au/vicroads/wms?STYLES=&LAYERS=vicroads:bluetooth_sites&FORMAT=image/png&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG:4326&BBOX=144.870,-38.640,145.645,-37.712&WIDTH=1400&HEIGHT=700&AUTH=%INSERT_TOKEN%


WMS Request - Get Map by Bounding Box and CQL Filter:

http://api.vicroads.vic.gov.au/vicroads/wms?STYLES=&LAYERS=vicroads:bluetooth_links&FORMAT=image/png&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG:4326&CQL_FILTER=congestion>5&BBOX=144.7,-38.1,145.3,-37.6&WIDTH=1400&HEIGHT=700&AUTH=%INSERT_TOKEN%


WFS Endpoint

Comprehensive WFS documentation is available on the Geoserver site. The most common type of WFS request is a GetFeature request for data:
http://api.vicroads.vic.gov.au/vicroads/wfs?
    service=wfs&
    version=2.0.0&    - 1.1.0 or 2.0.0 are most widely used
    request=GetFeature&
    typeNames=vicroads:bluetooth_links&    - Layer name, separate multiple with comma
    outputformat=application/json&    - Also supports 'csv', 'shape-zip' (Shapefile), 'GML2', 'GML3'
    srsname=EPSG:4326&
    bbox=144.87,-38.64,145.64,-37.71&   - Optional bounding box filter
    cql_filter=congestion>5&    - Optional attribute or spatial filter using CQL
    sortby=reportedtime+D&    - Optional sort, +D (Descending) or +A (Ascending)
    count=10    - Optional, leave it off to return everything


WFS Request - Get Capabilities:

http://api.vicroads.vic.gov.au/vicroads/wfs?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetCapabilities&AUTH=%INSERT_TOKEN%


WFS Request - Get Features by Bounding Box (JSON):

http://api.vicroads.vic.gov.au/vicroads/wfs?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&TYPENAMES=vicroads:bluetooth_sites&OUTPUTFORMAT=application/json&SRSNAME=EPSG:4326&BBOX=-38.348,144.686,-37.673,145.36&AUTH=%INSERT_TOKEN%


WFS Request - Get Features by CQL Filter (CSV):

http://api.vicroads.vic.gov.au/vicroads/wfs?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&TYPENAMES=vicroads:bluetooth_sites&OUTPUTFORMAT=csv&SRSNAME=EPSG:4326&CQL_FILTER=name='MAROONDAH DEEP CREEK'&AUTH=%INSERT_TOKEN%

OpenLayers 3 (Javascript)

OpenLayers 3 is an open source, javascript web mapping library. A full WMS example is available here. Here is a simple example:

var map = new ol.Map({
    layers: [
        new ol.layer.Tile({
            source: new ol.source.TileWMS({
                url: 'http://api.vicroads.vic.gov.au/vicroads/wms',
                params: {
                    'LAYERS': 'vicroads:bluetooth_links',
                    'TILED': true,
                    'AUTH': 'insert_token'
                },
                serverType: 'geoserver'
            })
        })
    ],
    target: 'map',
    view: new ol.View({
        projection: 'EPSG:4326',
        center: [144.96, -37.81],
        zoom: 10
    })
});


Leaflet (Javascript)

http://leafletjs.com/examples/wms/wms.html


GDAL/OGR (Command Line / C / Python)

ogr2ogr Command Line: http://www.gdal.org/ogr2ogr.html
C / C++: http://www.gdal.org/ogr_apitut.html
Python: http://gdal.org/python/
Python WFS: https://pcjericks.github.io/py-gdalogr-cookbook/vector_layers.html#get-wfs-layers-and-iterate-over-features
WMS: http://www.gdal.org/frmt_wms.html
WFS: http://www.gdal.org/drv_wfs.html


wfs-client (Node JS)

https://www.npmjs.com/package/wfs-client


OWSLib (Python)

https://geopython.github.io/OWSLib/


GeoTools (Java)

http://docs.geotools.org/stable/userguide/extension/wms/index.html
http://docs.geotools.org/stable/userguide/library/data/wfs.html


MapBox

https://www.mapbox.com/developers/


Carto

https://carto.com/docs/



Please refer to Data.Vic for metadata on the respective datasets.

Creative Commons licence

The VicRoads Transport Open Data API is licensed under a Creative Commons Attribution 4.0 International licence.



Creative Commons Attribution 4.0 International Licence is a standard form licence agreement that allows you to copy, distribute, transmit and adapt the VicRoads Transport Open Data API provided that you attribute the work. Both a summary of the licence terms and the full licence terms are available online from Creative Commons.

Disclaimer

The VicRoads Transport Open Data API is provided “as is” and VicRoads is not liable for how you use this data, how third parties use or rely on this data or any errors contained within the data. You are responsible for determining whether the VicRoads Transport Open Data API is suitable for your particular usage and purposes.



For more information refer to Data.Vic for metadata and licensing on the relevant dataset(s).

To request an API Token refer to the Overview section above.