24
Crash Course to Open Data and APIs Jaakko Rajaniemi Juha Yrjölä City of Helsinki

Crash course to Open Data and APIs

Embed Size (px)

DESCRIPTION

Crash course to Open Data and APIs was presented at Reaktor Dev Day 2013 by Jaakko Rajaniemi and Juha Yrjölä

Citation preview

Page 1: Crash course to Open Data and APIs

Crash Course to Open Data and APIs

Jaakko RajaniemiJuha Yrjölä

City of Helsinki

Page 2: Crash course to Open Data and APIs

What is Open Data?

● Availability and Free Access

● Reuse and Redistribution

● For Everybody, All Purposes and Free of Charge

Page 3: Crash course to Open Data and APIs

Why open data?

•Efficiency

•Transparency

•New cool and useful apps for citizens!

Page 4: Crash course to Open Data and APIs

The Classification of Open Data

★ Open license

★★ Machine readable

★★★ Non-proprietary format

★★★★ Open standards

★★★★★ Linked Data \o/

Page 5: Crash course to Open Data and APIs

Helsinki Region Transport

● Most popular open data source● API, Kalkati XML dump and GTFS● http://developer.reittiopas.fi/pages/en/home.php● Check also http://dev.hsl.fi/

Page 6: Crash course to Open Data and APIs

National Land Survey

Place names,Roads, Laser scanning data, Elevation data, ...

See more:

www.maanmittauslaitos.fi/en/opendata

Municipal Division in Finland

Topographic database Topographic map raster Basic map raster

Aerial and orto photos

Page 7: Crash course to Open Data and APIs

Finnish Meteorological Institute

● Weather observation 400 locations● Weather forecasts● Street condition 375 locations● Rain and radar lightning data ● Time series

● https://github.com/fmidev/● http://en.ilmatieteenlaitos.fi/open-data-manual● Open Geospatial Consortium

http://ilmatieteenlaitos.fi/avoin-data-avattavat-aineistothttp://ilmatieteenlaitos.fi/avoin-data-havaintoanimaattori

Page 8: Crash course to Open Data and APIs

Where to find data?

Helsinki Region Infoshare

Page 9: Crash course to Open Data and APIs

dev.hel.fi

#heldev

Page 10: Crash course to Open Data and APIs

Code for Europe

● Motivation: Current IT service development practices not perfect; introduce new ideas and technologies from outside

● Who: European Union and participating cities

● Method: Independent Fellows hired for a limited period to develop services

● 2014 Fellowship coming up

Page 11: Crash course to Open Data and APIs

Real-time Snowplow Location API

github.com/codeforeurope/aura/wiki/API

Page 12: Crash course to Open Data and APIs

Helsinki From Above 1942-2012

● Open Datasets used:○ aerial photography from five decades building

database○ address database○ district boundaries○ OpenStreetMap

● Aerial photos converted into an image pyramid and imported into Geoserver, then served over WMS API

● HTML5 application to access it: dev.hel.fi/ilmakuvat/ (Fork me on GitHub)

Page 13: Crash course to Open Data and APIs

Service Map API

● 8,000 points of interest● 800 services● REST API with more than 200000 hits per month● http://www.hel.fi/palvelukarttaws/rest/ver2_en.html

Page 14: Crash course to Open Data and APIs

Service Map API demo

http://dev.hel.fi/open311-test/servicemapdemo.html

Page 15: Crash course to Open Data and APIs

Issue reporting API / Palauterajapinta

● First read-write API in Finland!

● Based on Open311 (also known as GeoReport v2)

○ http://open311.org/

● http://dev.hel.fi/apis/issuereporting

● Used in more than 30 cities in US and now coming to Europe

Page 16: Crash course to Open Data and APIs

CitySDK - Common interfaces between cities

Issue reporting aka Open311 API developed in other cities

http://www.citysdk.eu/developers/

Page 17: Crash course to Open Data and APIs
Page 18: Crash course to Open Data and APIs

Issue reporting API functionalities

1. Query service request types○ defines request types and extra attributes

2. Submit service request○ description, image, location, contact

information

3. Query individual service request○ status and other service request details

4. Query services requests○ based on time and location

Page 19: Crash course to Open Data and APIs

Issue Reporting demoService request types:

https://asiointi.hel.fi/palautews/rest/v1/services.json?locale=fi_FI

Last services requests:

https://asiointi.hel.fi/palautews/rest/v1/requests.json

Individual service request:

https://asiointi.hel.fi/palautews/rest/v1/requests/2278m9r1a1f50dhb1mug.json?extensions=true

More queries: https://docs.google.com/document/d/12eU3RVVTnEfHw1YsV48Li1E6ZGz-WmXoY70T3eIdA9w/edit?usp=sharing

Demos

http://dev.hel.fi/open311-test/pinpoint.html

http://dev.hel.fi/open311-test/servicemap.html

Page 20: Crash course to Open Data and APIs

Python Three

Three is simple open source Open311 client

from three import Three

>>t = Three('https://pate.affecto.com/restWAR/open311/v1', api_key='API_KEY_HERE')

>>resp = t.post('202', name='Jaakko Rajaniemi', lat='60.168321', long='24.952397', description='Traffic sign is broken.',email='[email protected]', media=open('traffic_sign.jpg', 'rb'))

Page 21: Crash course to Open Data and APIs

GeoReporterOpen source mobile application for Open311 reporting● https://github.com/City-of-Bloomington/open311-mobile/

● https://github.com/City-of-Bloomington/open311-android

Android: https://itunes.apple.com/us/app/georeporter/id487304759?mt=8

iPhone: https://play.google.com/store/apps/details?id=gov.in.bloomington.georeporter&hl=fi

Page 22: Crash course to Open Data and APIs

OpenAhjo Decision Data API

● Access to the enriched decision-making data of City of Helsinki

● Built on top of document and decision management system Ahjo

● REST API with geospatial and full-text search capabilities

● Autogenerated API documentation: dev.hel.fi/openahjo/doc/

● HTML5 application for browsing the data: dev.hel.fi/openahjo/

Page 23: Crash course to Open Data and APIs

OpenAhjo Under the Hood

Backend● Python● Django application● Tastypie REST API● PostgreSQL database with PostGIS● Solr search engine with Finnish stemming

Frontend● CoffeeScript● Backbone● Leaflet JS map library

Page 24: Crash course to Open Data and APIs

Thank you!

Jaakko Rajaniemi● [email protected]

● +358 40 5165931

● @jaakko

Juha Yrjölä● [email protected]