# City of Ottawa Open Data
Not all data will be provided as a beautifully maintained and documented API. Some times just the raw data is available online.
The City of Ottawa maintains a fairly good set of Open Data documents that you can download and use. The home page for their site is: http://data.ottawa.ca/
They have datasets representing many different aspects of the City of Ottawa.
Here is one example -
Web page for the water-bodies data
The actual data water-body data in GeoJSON format
When it comes to data like this, you need to be able to handle different formats and many times a CORS issue. They are providing the data free to use but it cannot be used directly from your webpage because they are not sending the Access-Control-Allow-Origin
header. This means that while you can fetch the file, you can't use the data.
The way we get around this is:
- Download a copy of the file and keep it on our own server. Occassionally you may need to download a new copy for your server.
- Use a server-side request using NodeJS or PHP or Ruby or ASP.Net to fetch the data. Your webpage makes the JS fetch request to the server-side page on your own domain, which will get the data and return it along with the
Access-Control-Allow-Origin
header.
# Open311
Moving beyond the static data files that the city provides, there is an API that you can use to get access to the live data. This API follows a standard called Open311 which is being used by many smart cities.
Ottawa Open311 Developer Resources
Developer Getting Started guide. On this page you can look at all the different calls you can make with the API.
The base URL for the API is: https://city-of-ottawa-dev.apigee.net/open311/v2 .
The data that is currently available through the Open311 API for Ottawa includes:
- Solid Waste (Garbage)
- Roads Maintenance
- Graffiti
- By-law
- Parks and Forestry
- Parking
- Street lighting
To be able to use the Open311 Ottawa API you need to register and get a key. Use this Registration Form