Skip to content

Instantly share code, notes, and snippets.

#-*- coding: utf-8 -*-
import android
import time
# Abro el archivo texto donde voy a escribir los datos
archivo = open(u'/storage/sdcard0/logs/lista_wifis.txt', 'a')
droid = android.Android()
# Empiezo a buscar mi ubicacion
droid.startLocating()
lat lon precision num_wifis mode
-12.1499172345 -77.0218045577 10 2 gps
-12.15012914 -77.0220069267 15 3 gps
-12.150485316 -77.0218606556 20 1 gps
-12.1510593514 -77.0220010924 40 2 gps
-12.1507377886 -77.0213838026 40 3 gps
-12.1504756054 -77.020423881 35 3 gps
-12.1497932144 -77.0207808547 35 1 gps
-12.1497743881 -77.0209034532 40 3 gps
-12.1487638637 -77.0209229277 30 2 gps
@pvernier
pvernier / filtro_antimap.py
Last active December 19, 2015 09:09
Script para filtrar los datos obtenidos por la app AntiMap Log (http://theantimap.com/category/applications/antimap-log/)
# -*- coding: utf8 -*-
import os
import datetime
# Pongo todos mis archivo antimap en una carpeta 'antimap'
carpeta = u'/antimap'
# El nombre del archivo que quiero filtar
archivo = u'130912_0924_24.csv'
18.531561,-72.253371,225,0.00,0.06,73,
18.531561,-72.253371,225,0.00,0.06,132,
18.531561,-72.253371,225,0.00,0.06,174,
18.531561,-72.253371,225,0.00,0.06,205,
18.531561,-72.253371,225,0.00,0.06,236,
18.531561,-72.253371,225,0.00,0.06,270,
18.531561,-72.253371,225,0.00,0.06,303,
18.531561,-72.253371,225,0.00,0.06,337,
18.531561,-72.253371,225,0.00,0.06,370,
18.531561,-72.253371,225,0.00,0.06,403,
Y X compass speed distance time
18.531561 -72.253371 225 0.00 0.06 2012-09-13 09:24:24.073000
18.531479 -72.253406 218 0.00 0.07 2012-09-13 09:24:30.003000
18.531414 -72.253365 211 1.87 0.08 2012-09-13 09:24:35.337000
18.531364 -72.253285 142 2.57 0.09 2012-09-13 09:24:42.842000
18.531330 -72.253207 124 3.24 0.10 2012-09-13 09:24:45.972000
18.531290 -72.253134 102 3.96 0.11 2012-09-13 09:24:50.438000
18.531204 -72.253099 110 4.02 0.12 2012-09-13 09:24:55.006000
18.531119 -72.253061 109 4.07 0.13 2012-09-13 09:24:59.973000
18.531046 -72.253122 110 4.13 0.14 2012-09-13 09:25:04.976000
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
var wifis = [
[ -77.021804557699994, -12.1499172345, 2 ],
[ -77.022006926700001, -12.15012914, 3 ],
[ -77.021860655599994, -12.150485316, 1 ],
[ -77.022001092400004, -12.151059351400001 , 2],
[ -77.021383802599999, -12.150737788600001, 3 ],
[ -77.020423881, -12.1504756054, 3 ],
[ -77.020780854700007, -12.149793214400001, 1 ],
[ -77.020903453200006, -12.149774388100001, 3 ],
[ -77.020922927699999, -12.148763863699999, 2 ],
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf8" />
<title>HeatMap de los wifis en Barranco</title>
<link rel="stylesheet" href="/site_media/js/Leaflet/leaflet.css" />
<script src="/site_media/js/Leaflet/leaflet.js" type="text/javascript"></script>
<script type="text/javascript" src="/site_media/js/heatcanvas/heatcanvas.js"></script>
<script type="text/javascript" src="/site_media/js/heatcanvas/heatcanvas-leaflet.js"></script>
<script src="/site_media/js/demo/wifis_barranco.js" type="text/javascript"></script>
<!DOCTYPE html>
<html>
<head>
<title>Wifis Barranco</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/site_media/js/Leaflet/leaflet.css" />
<!--[if lte IE 8]><link rel="stylesheet" href="../leaflet.ie.css" /><![endif]-->
CREATE TABLE data.data_us -- He creado antes un esquema llamado "data" en el cual vamos a poner las diferentes tables
(
secs NUMERIC(6, 1), -- redondeo los segundos a 10-1 porque el achivo NZ tiene los segundos a 10-3, asi tendré los mismos valores en ambas tablas
lat NUMERIC,
long NUMERIC,
wind_dir NUMERIC,
wind_speed NUMERIC
);
-- Importo los datos del archivo CSV en la tabla creada antes
COPY data.data_us FROM 'C:\path\us.csv' DELIMITER ',' CSV HEADER;