Skip to content

Instantly share code, notes, and snippets.

View marcellobenigno's full-sized avatar
😃
Python ❤

Marcello Benigno marcellobenigno

😃
Python ❤
  • João Pessoa / Paraíba / Brazil
View GitHub Profile
# Watershed SFDo
r.watershed --o -a elevation=srtm.clip accumulation=accumulation drainage=drainage convergence=5 threshold=123
#Without SFDo
#r.watershed elevation=srtm.clip threshold=555 accumulation=accumulation1 drainage=drainage1 basin=ba500
#r.watershed elevation=filled_clip_srtm_gramame threshold=123 accumulation=accum drainage= dirs basin=ba1000 stream=streams
#Stream extraction:
r.stream.extract --o elevation=srtm.clip threshold=123 d8cut=infinity mexp=0 stream_rast=streams direction=drain_dir stream_vect=v_streams
@marcellobenigno
marcellobenigno / mshp2postgis.sh
Created October 12, 2012 22:43
Load multiple shapefiles into PostGIS
#!/bin/bash
#change the SRID if necessary
for f in *.shp
do
shp2pgsql -s 29185 $f `basename $f .shp` > `basename $f .shp`.sql
done
@marcellobenigno
marcellobenigno / gist:3913340
Last active October 11, 2015 20:17
Pré-processamento dos dados no GRASS - ghydroweb_location
1 - Configurar a conexão com o banco PostgreSQL/PostGIS “ghydroweb”:
db.connect driver=pg database="host=localhost,dbname=ghydroweb"
#db.connect database=host=localhost,dbname=ghydroweb schema=grass
db.login user=marcello pass=x
db.connect -p
db.tables -p
2 – Configurar a Region para o DEM:
@marcellobenigno
marcellobenigno / testes.sql
Last active October 11, 2015 21:38
SWING - algumas tarefas e dúvidas
--ATUALIZAÇÃO DO SIGA:
ALTER TABLE ms_1213_verao RENAME ucs TO ms_ucs;
ALTER TABLE ms_1213_verao RENAME hectares TO ha;
ALTER TABLE ms_1213_verao RENAME the_geom TO geom;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO webgis;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO webgis;
-- EM SEGUIDA DEVE-SE
--CRIAR OS MAPFILES DA NOVA SAFRA
<?php
class Posto_plu extends CI_Controller {
function __construct() {
parent::__construct();
}
function index() {
$data['titulo'] = "Cadastro de Postos Pluviométricos";
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
body {font-size: 12px; padding: 5px;}
</style>
<title>Editar Posto Pluviométrico</title>
</head>
<body>
-- QUANDO OS DADOS ESTIVEREM EM COORDENADAS GEOGRÁFICAS, PARA REALIZAR A MEDIÇÃO DE DISTÂNCIAS E DE ÁREAS,
-- DEVE-SE UTILIZAR O COMANDO Geography(geom), EX. :
SELECT ST_Distance(Geography(a.geom), Geography(b.geom))/1000 as dist_km,
ST_Area(Geography(a.geom)) AS a1, ST_Area(Geography(b.geom)) AS b1
FROM municipios_pb a, municipios_pb b
WHERE a.nome = 'Patos' AND b.nome = 'Campina Grande';
@marcellobenigno
marcellobenigno / gist:4740314
Created February 8, 2013 16:54
Iniciar o PostgreSQL quando ele dá pau
sudo mkdir -p /usr/local/pgsql/data
sudo chown -R postgres:postgres /usr/local/pgsql/
sudo su - posgresql
cd /usr/lib/postgresql/8.2/bin/
./initdb -D /usr/local/pgsql/data
./postgres -D /usr/local/pgsql/data
@marcellobenigno
marcellobenigno / exemplos.php
Last active December 15, 2015 15:58
Dicas sobre o Laravel
//após a instalação, mudar as permissões:
$ chmod -R 755 app/storage
// Rota passando parametros para um controller:
Route::get('admin/categorias/{id}', 'CategoriasController@destroy');
relacoes n para n :
http://vegibit.com/many-to-many-relationships-in-laravel/
<!DOCTYPE html>
<html>
<head>
<title>EX 2 - Leaflet</title>
<link rel="stylesheet" href="lib/leaflet.css" />
<script src="lib/leaflet.js"></script>
<script src="lib/Google.js"></script>
<script src="lib/Bing.js"></script>
<script src="http://maps.google.com/maps/api/js?v=3.2&sensor=false"></script>
</head>