250K drones con cámaras infrarrojas
Detectan infección por temperatura
Envían una lectura cada segundo
Resolución máxima: 1000 zombies
*Cada drone cubre unos 4Km cuadrados
{
"drone-id" : 1000000,
"timestamp" : "2016-01-01T10:22:00",
"latitude" : 42.0343,
"longitude" : 2.40324
}
Servicio de ingesta manejado
Capacidad ilimitada y escalable
Unidad de ingesta: Shard
Número de secuencia +
Clave de partición +
Blob de datos
Unidad de escritura: 25K
1000 registros por segundo
Máximo 1MB por segundo
250.000 registros/s
1.000 registros/shards + 10%
275 shards
$0.015 shard/h
$0.014 por millón de puts
$2970 + $9072 al mes*
*podemos escalar hacia abajo si vamos justos de prespuesto
¿Qué queremos hacer?
Visualizar puntos calientes
Lat Lng representa un punto 3D
Los mapas son 2D
UTM es la proyección + popular
¡Además facilita la agregación!
41.390205N 2.154007E
31N 429271E 4582420N
31N 429 4582 <-1Km^2
31N 42 458 <- 100Km^2
Correctamente distribuído
Permite agrupar por km^2
AWS Mobile SDK
Kinesis Agent (utilidad java)
Kinesis Producer library (c++)
KPL java wrapper
Kinesis Client Library (java)
KCL daemon (utilidad java)
ObjectMapper mapper = new ObjectMapper();
KinesisProducer kinesis = new KinesisProducer();
while(true) {
ZombieLecture lect = nextLecture();
LatLng latLng = lect.getCoordinates();
UTM utm = Projections.toUTM(latLng);
String shardKey = utm.asString(1000 /*meters*/);
String json = mapper.writeValueAsString(lect);
ByteBuffer data =
ByteBuffer.wrap(json.getBytes("UTF-8"));
kinesis.addUserRecord("zombieStream", shardKey, data);
}
// iterator to iterate *inside* a shard
shardIterator = getShardIteratorResult.getShardIterator();
List<Record> records;
while (true) {
GetRecordsRequest recRequest = new GetRecordsRequest();
recRequest .setShardIterator(shardIterator);
recRequest .setLimit(25);
GetRecordsResult result = client.getRecords(recRequest );
records = result.getRecords();
this.processRecords(records);
shardIterator = result.getNextShardIterator();
}
Procesamiento en tiempo real
Basado en topografías
Kinesis Storm Spout como origen
Bolts para agregar y almacenar
Librería ligera para mapas
Funciona en móviles
Excelente API
Dispone de decenas de plugins
Permite dibujar heatmaps
var map = L.map('map') .setView([41.3902, 2.15400], 13); L.tileLayer('http://{s}.tile.osm.org'+ '/{z}/{x}/{y}.png', {}) .addTo(map); $.ajax(...) .done(function(points) { var heat = L.heatLayer(points) .addTo(map); });