Skip to content

Instantly share code, notes, and snippets.

View FelipeSBarros's full-sized avatar

Felipe Sodré M. Barros FelipeSBarros

View GitHub Profile

Projetos

@RemotePixel: Making Earth Observation available to everyone #Landsat #MODIS #VIIRS #Sentinel #Webmapping #OpenData
@CopernicusEU: The European Union Earth Observation Programme
@open_EO: openEO - A Common, Open Source Interface between Earth Observation Data Infrastructures and Front-End Applications
@geography2050: Geography 2050: Powering Our Future Planet - A multi-year strategic dialog on the vital trends that will reshape the geography of our planet. Nov15-16, 2018 NYC
@GEOSEC2025: GEO advocates & delivers open Earth observation data, with 400m+ free & open EO resources for UN Agenda 2030, climate change, disaster resilience & other areas
@UrbicaDesign: We are urban data analysis company working on human experience in the city.
[@BigDataEcology](https://twitter.com

@FelipeSBarros
FelipeSBarros / Instalación R y RStudio
Last active February 8, 2018 19:17
Script de instalación de R, RStudio y algunos paquetes más...
# Update & upgrade
sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get autoremove && sudo apt-get autoclean && sudo apt-get clean
# ADD repository
# Rstudio
sudo echo "deb http://cran.rstudio.com/bin/linux/ubuntu xenial/" | sudo tee -a /etc/apt/sources.list
sudo sh -c "echo 'deb http://cran.fiocruz.br/bin/linux/ubuntu xenial/' >> /etc/apt/sources.list"
# Installing R
sudo apt-get install r-base r-base-dev
# Downloading RStudio
sudo apt-get update && sudo apt-get install libgdal-dev libgdal1-dev libproj-dev libgeos-dev #https://stackoverflow.com/questions/31342575/rgdal-wont-install
# data from http://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/population-distribution-demography/geostat
# Originally seen at http://spatial.ly/2014/08/population-lines/
# So, this blew up on both Reddit and Twitter. Two bugs fixed (southern Spain was a mess,
# and some countries where missing -- measure twice, submit once, damnit), and two silly superflous lines removed after
# @hadleywickham pointed that out. Also, switched from geom_segment to geom_line.
# The result of the code below can be seen at http://imgur.com/ob8c8ph
library(tidyverse)
@FelipeSBarros
FelipeSBarros / Bot_run.sh
Last active January 27, 2018 20:08
Bash script to leave a bot running forever
#!/bin/sh
# This script keeps the bot running "forever", if it dies
# the script will relaunch it
RC=1
while [ $RC -ne 0 ]; do
python3 bot.py
RC=$?
done
@FelipeSBarros
FelipeSBarros / Py_install.sh
Last active February 10, 2018 17:53
Few libs for completely install python
sudo apt-get update &&
sudo apt-get upgrade &&
sudo apt-get autoremove &&
sudo apt-get autoclean &&
sudo apt-get clean &&
sudo apt-get install sqlite3 &&
sudo apt-get install -y python3-pip &&
sudo apt-get install build-essential libssl-dev libffi-dev python-dev &&
sudo apt-get install -y python3-venv python3-bs4 python3-pandas*
library(ggplot2)
library(ggmap)
library(maps)
library(mapdata)
library(dismo)
#Usando dados do pacote "mapdata"
usa <- map_data("usa") # Definindo qual dado queremos trabalhar
ggplot() +
geom_polygon(data = usa, aes(x=long, y = lat, group = group)) + # Aqui estamos usando o data frame "usa" para plotar-lo como poligono
coord_fixed(1.3)
/*
This is an example Overpass query.
Try it out by pressing the Run button above!
You can find more examples with the Load tool.
*/
[out:json][timeout:25];
//Buscando area "Posadas"
area(3602294383)->.searchArea;
//Results
(
@FelipeSBarros
FelipeSBarros / geoCoding.py
Created September 20, 2017 12:38
Small function for geocoding using GraphHopper API. From Adress, recieve json with lat/long point location
import requests
import urllib
def geocode(address, city, state, zip_code):
try:
location_param = ("%s+%s+%s+%s" % ("Pedernera", "Posadas", "Misiones", "2037"))
#url_request = "http://nominatim.openstreetmap.org/search?q=" + location_param + "&format=json&polygon_geojson=1"
#url_request = "maps.googleapis.com/maps/api/geocode/json?address=%s&sensor=false" % location_param
url_request = "http://graphhopper.com/api/1/geocode?q=" + location_param + "&key=PUT_YOUR_KEY_HERE"
result = requests.get(url_request)
#Atenção:
# comandos meramente ilustrativos. Vários parâmetros dos comando usados (shp2pgsql) foram ignorados!
# ${a%.*} remove a extenção .shp do nome
for a in *.shp; do echo "Convertentado $a"; shp2pgsql $a schema.table > ${a%.*}.sql; done
# Depois, para cada .SQL:
for b in *.sql; do psql -d iis -f $b; done
@FelipeSBarros
FelipeSBarros / rasterTableDB.csv
Created September 12, 2017 20:56
RasterDataTable
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 9.
"Path","nome","data_source","resolution","description","period"
"./worldclim/v2/30sec/presente/wc2.0_bio_30s_04.tif","bio4","worldclim v2","30s","Temperature Seasonality (standard deviation *100)","presente"
"./worldclim/v2/30sec/presente/wc2.0_bio_30s_01.tif","bio1","worldclim v2","30s","Annual Mean Temperature","presente"
"./worldclim/v2/30sec/presente/wc2.0_bio_30s_19.tif","bio19","worldclim v2","30s","Precipitation of Coldest Quarter","presente"
"./worldclim/v2/30sec/presente/wc2.0_bio_30s_02.tif","bio2","worldclim v2","30s","Mean Diurnal Range (Mean of monthly (max temp - min temp))","presente"
"./worldclim/v2/30sec/presente/wc2.0_bio_30s_16.tif","bio16","worldclim v2","30s","Precipitation of Wettest Quarter","presente"
"./worldclim/v2/30sec/presente/wc2.0_bio_30s_05.tif","bio5","worldclim v2","30s","Max Temperature of Warmest Month","presente"
"./worldclim/v2/30sec/presente/wc2.0_bio_30s_03.tif","bio3","worldclim v2","30s","Isothermality (BIO2/BIO7) (* 100)","presente"
"./worldclim/v2/30sec/presente/wc2