building location-aware apps with open source & open data

Post on 27-May-2015

586 Views

Category:

Technology

3 Downloads

Preview:

Click to see full reader

DESCRIPTION

A map can show you where you are or how to get from here to there. But in a world of location aware devices maps can do so much more. Maps and location-based features are the foundation for many apps and provide a rich contextual experience that transforms based on your environment. Open source location services and map frameworks can give you greater transparency, flexibility, compatibility, and control when building location-based apps. This talk will explore how to implement maps and other location-aware features on Android using open source and open data.

TRANSCRIPT

Building Location-Aware Appswith Open Source & Open Data

Chuck Greb | 9·21·2014 | Droidcon NYC

start where you are

start where you are

Building Location-Aware Appswith Open Source & Open Data

Building Location-Aware Appswith Open Source & Open Data

3 kinds of location-aware apps

⇢ Map applications

⇢ Location based apps

⇢ Apps with location aware features

Location-Aware Apps

Building Location-Aware Appswith Open Source & Open Data

Philosophy

Open Source

Code

Open Source

License

Open Source

Community

Open Source

Advantages

⇢ Transparency

⇢ Flexibility

⇢ Compatibility

⇢ Free!

Open Source

Open source is not free like beer

Open Source

Open source is free like a puppy

Open Source

Building Location-Aware Appswith Open Source & Open Data

Availability & Access

Open Data

Reuse & Redistribution

Open Data

Universal participation

Open Data

Open Knowledge Foundationhttps://okfn.org/

Open Data

Building Location-Aware Appswith Open Source & Open Data

Components

Open Location Applications

Datasource

Open Location Applications

Vector Tiles

Open Location Applications

Renderer

Open Location Applications

Location Services

Open Location Applications

GPS, Network, Sensors, BLE

Geocoder

Open Location Applications

Search Engine

Open Location Applications

Route Engine

Open Location Applications

OpenStreetMap (OSM)

⇢ Crowdsourced Data

⬝ Local knowledge

⬝ Community driven

⇢ Public Data

⬝ 2007 TIGER import

⬝ Manual import process

⇢ Open Data Commons Open Database License (ODbL)

⬝ Attribution

⬝ Share-Alike

⬝ Keep Open

OpenStreetMap (OSM)

osmdroid

2008

osmdroid

Based on Google Maps API v1

osmdroid

Support for online and offline tile source

osmdroid

Icons, tracking, and shapes

osmdroid

Mapbox

Fork of osmdroid

Mapbox

Easy integration with Mapbox tile server

Mapbox

<com.mapbox.mapboxsdk.views.MapView

android:id="@+id/mapview"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

mapbox:mapid="Your Mapbox mapid" />

Mapbox

MapView mapView = new MapView(this, "Your Mapbox mapid");

this.setContentView(mapView);

Mapbox

(Alternate tile servers also supported)

Mapbox

Custom styles & satellite imagery

Mapbox

OpenScienceMap

Universität Bremen

OpenScienceMap

“OpenScienceMap provides free and open maps for Android with the fastest and 100% pure vector maps around.”

OpenScienceMap

<org.oscim.android.MapView

android:id="@+id/map"

android:layout_width="match_parent"

android:layout_height="match_parent" />

OpenScienceMap

public class MyActivity extends MapActivity {

...

public Map getMap() {

return super.map();

}

}

OpenScienceMap

@Override public void onCreate(Bundle icicle) {

super.onCreate(icicle);

UrlTileSource tileSource = new OSciMap4TileSource("http://vector.example.com/all");

VectorTileLayer baseLayer = getMap().setBaseMap(tileSource);

getMap().layers().add(new BuildingLayer(getMap(), baseLayer));

getMap().layers().add(new PoiLayer(getMap(), baseLayer));

getMap().layers().add(new LabelLayer(getMap(), baseLayer));

baseLayer.setRenderTheme(ThemeLoader.load(

AssetAdapter.g.openFileAsStream("styles/map.xml)")));

}

OpenScienceMap

Mapzen

Pelias

Mapzen

getPelias().suggest("Empire State Build", Callback<Result>);

getPelias().search("Empire State Building", "x1,y1,x2,y2", Callback<Result>);

Mapzen (Pelias)

On the Road

Mapzen

OSRM

Router.getRouter().setEndpoint("http://osrm.example.com")

.setDriving()

.setLocation(new double[]{lat, lng})

.setLocation(new double[]{lat, lng})

.setCallback(new Callback() {

@Override

public void success(Route route) {

// do stuff

}

@Override

public void failure(int statusCode) {

// do stuff

}

}).fetch();

Mapzen (On the Road)

LOSTLocation Open Source TrackerLocation Open Source Tracker

Mapzen

LocationClient locationClient = new LocationClient(context,

new LocationClient.ConnectionCallbacks() {

@Override public void onConnected(Bundle bundle) {

onLocationClientConnected();

}

@Override public void onDisconnected() {

onLocationClientDisconnected();

}

});

Mapzen (LOST)

private void onLocationClientConnected() {

Location lastLocation = locationClient.getLastLocation();

if (lastLocation != null) {

// do stuff

}

LocationRequest locationRequest = LocationRequest.create();

locationRequest.setInterval(5000);

locationClient.requestLocationUpdates(locationRequest,

new LocationListener() {

@Override public void onLocationChanged(Location location) {

// do more stuff

}

});

}

Mapzen (LOST)

Mapzen Android Demo

Mapzen

Mapzen Android Demo

Pelias Android SDK On the Road LOSTOpenScienceMap

VTM Speakerbox

TTSLocationManagerOSRMPeliasVector

Datasource OpenGL ES

start where you are

Ineke!Chuck Greb | @ecgreb

github.com/mapzen

top related