Open Data Catalogue for Developers
The Open Data Publisher is a two part application for browsing and querying open data from the City of Nanaimo. The Data Catalogue is set up for browsing through the available data sets and viewing external download links. The Data Api which provides to the data to the Catalogue and is open for use to the public. The api provides a queryable interface to access the City of Nanaimo's open data in a variety of formats described below.
Querying Open Data Publisher Data Service
The Open Data Publisher (ODP) data service exposes data through REST Web services. The basic format of an ODP service call is http://host/v1/container/dataset?query, where:
- container is the name of the container (container is currently "sql").
- dataset is the name of the data set (for example, "BusinessLicences" for the Business Licence data set in the Nanaimo container).
- query is your set of query parameters, expressed using a subset of the WCF Data Services query syntax.
Note that ODP currently only supports the $filter and $top query options in the WCF Data Services query syntax. Example queries using the Crime Incidents data set are available on the Data Browser page of our Interactive SDK.
Also note that if a property has a null value for a particular entity in the data set, it will be omitted entirely from the result set returned by ODP. For example, in the Crime Incidents data set, the "method" property is only returned for records that have a "method" value in the underlying data set. Your application design should take this into account and handle potentially missing properties.
Most of our datasets are currently download only such as city-owned Fiber or Roads. We are working on providing more datasets with an api connection available like the Business Licence and Fire and Rescue Incident Response datasets.
By default, ODP returns data in the Open Data Protocol (OData) format. This format extends the broadly adopted Atom Publishing Protocol and can be easily consumed by a variety of platforms, including Microsoft .NET, Java, Ruby, PHP, and Python. Refer to the code samples on the Data Browser page for examples.
Many of the data sets in ODP also include geospatial data, which is returned in the Keyhole Markup Language (KML) format. This format is compatible with popular desktop and Web-based mapping technologies including Google Maps and Google Earth.
To return geospatial data in KML format, append the format=kml parameter to your query. Example:
http://api.nanaimo.ca/dataservice/v1/sql/BusinessLicences/?$filter=NAICSCategory eq 'A5400'&format=kml
Note that if the data set that you are using does not include any geospatial data, a KML query to ODP will return an empty result set.
Developers using Microsoft Visual Studio 2008, Service Pack 1 (or later) can use WCF Data Services to access data from ODP through easy-to-use .NET classes. Within Visual Studio, this is accomplished by using the Add Service Reference feature (see .NET samples on the Data Browser page). To make accessing ODP data easier, Java developers can use Restlet Extension for WCF Data Services. PHP developers can take advantage of the Toolkit forToolkit for PHP with WCF Data Services.
Open Data Publisher is a fork of Microsoft's OGDI project, rewritten to easily publish information from Microsoft SQL Server tables and views using the OData protocol, KML, and JSON. Feel free to download the Open Data Publisher source code from Codeplex.