Also take a look at the directional coloration map
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Animals | CartoDB.js</title> | |
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/> | |
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" /> | |
<style> | |
html, body, #map { | |
height: 100%; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let beforeCommute = SetSDK.Context( | |
notificationTiming: .upon, | |
eventAction: .exit, | |
eventState: .place(type: .home), | |
timeOfDay: .morning | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SetSDK.register(context: beforeCommute) { event as | |
// Send new information or an opportunity that will be valuable | |
let content = UNMutableNotificationContent() | |
content.title = "Weather Alert!" | |
// ... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RideFinderViewController: UIViewController { | |
... | |
override func viewDidAppear(_ animated: Bool) { | |
// this view indicates an intent to go someplace | |
super.viewDidAppear(animated) | |
// Get the user's likely destinations using the SetSDK | |
// For custom control of starting location, see: http://bit.ly/getDestinationV1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RideFinderViewController: UIViewController, CLLocationManagerDelegate { | |
let locationManager = CLLocationManager() | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
locationManager.delegate = self | |
locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters | |
locationManager.startUpdatingLocation() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SetSDK.instance.onDeparture(.home) { departure in | |
// Turn off lights, kill the music, lock the doors | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// departure subscription | |
SetSDK.instance.onDeparture(.home) { departure in | |
// on departure, predict their likely destination | |
if let destinations = SetSDK.instance.getDestination(fromLocation: departure.location, fromTimestamp: departure.date), let destination = destinations.first { | |
// Process the top destination predictions | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TYPE pluto_reverse_geocode_result AS (address text, ownername text,distance float); | |
CREATE OR REPLACE FUNCTION pluto_reverse_geocode(float,float,int) RETURNS SETOF pluto_reverse_geocode_result | |
AS ' | |
WITH subq as (SELECT address,the_geom,ownername | |
FROM nyc_mappluto_13v1 | |
ORDER BY the_geom <-> CDB_LatLng($1,$2) LIMIT 20) | |
SELECT address,ownername, | |
ST_Distance(the_geom::geography, CDB_LatLng($1,$2)::geography) as distance | |
FROM subq | |
WHERE ST_Distance(the_geom::geography, CDB_LatLng($1,$2)::geography) < $3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Leaflet.draw drawing and editing tools</title> | |
<link | |
rel="stylesheet" | |
href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" | |
/> | |
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/themes/css/cartodb.css" /> | |
<link |