Skip to content

Instantly share code, notes, and snippets.

View leodc's full-sized avatar

Leonel Castañeda leodc

View GitHub Profile
@leodc
leodc / renameGeoserverLayers.py
Last active June 27, 2018 15:02
python3 renameGeoserverLayers.py data_directory
#!/usr/bin/python3
import os
import sys
import shutil
import urllib.request
import json
import xml.etree.ElementTree as etree
import subprocess
@leodc
leodc / carto.sh
Last active February 6, 2018 18:55
Guia de deploy de carto
# https://hub.docker.com/r/sverhoeven/cartodb/
sudo docker pull sverhoeven/cartodb
# ip_publica
CARTO_HOST="138.68.253.242"
# puerto de salida del host
CARTO_PORT=80
# agregamos cartodb.localhost como alias del localhost
#!/bin/bash
# install dependencies
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
# add repo
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
# update
@leodc
leodc / addLayersToGeoserver.py
Last active June 26, 2018 16:53
Help script to publish postgis tables to geoserver
#!/usr/bin/python3
import os
import sys
import psycopg2
import subprocess
import urllib.request
import json
POSTGRES_DBNAME = os.getenv("POSTGRES_DBNAME")
@leodc
leodc / conaguaCompilado.py
Last active March 26, 2018 23:40
script para generar compilados de los datos abiertos de conagua: https://datos.gob.mx/busca/dataset/precipitacion-actual-y-acumulada-por-estacion
#!/usr/bin/python3
#coding=utf-8
import json
import time
from xmljson import parker, Parker
from xml.etree.ElementTree import fromstring
from suds.client import Client
<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">
<NamedLayer>
<UserStyle>
<Title>Default point</Title>
<Abstract>A sample style that just prints out a 6px wide red square</Abstract>
<FeatureTypeStyle>
<Rule>
<Title>Red square</Title>
<!DOCTYPE html>
<html>
<head>
<title>Repubikla - rutas</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="image/x-icon" href="docs/images/favicon.ico" />
f7da72c9_a10c_4d89_9cc0_8e3e83ce93a6__curva_nivel50_l
eb2327a4_d059_4c53_9832_9251f9708c42__linea_com50_l
78ffe6d6_bfe9_49e5_9e7f_11c9516ccdd5__camino50_l
413900e1_3ea6_4500_bd29_5fc5c33b50e4__calle50_l
d02f3ac7_75ba_4671_9837_4ecb8ee607d0__pozo_explot50_p
a936e80b_8a09_4580_a6e7_d631ecf272a5__linea_com50_l
0f04b76a_4be7_4f82_9fba_764297f73ec9__camino50_l
412f2057_f1c4_46ff_8e15_c701a65059e3__tanque_agua50_p
27ba4211_3dd2_4526_96d5_75e97d8b9acc__edificacion50_p
1afb8e4a_504b_4c59_8902_66f217394d95__carretera50_l
@leodc
leodc / download_csv.conf
Created November 21, 2019 00:17
NGINX config to download files
server {
listen 80;
server_name default_server;
location ~ ^.*/(?P<request_basename>[^/]+\.(csv))$ {
root /www/data/;
add_header Content-Disposition 'attachment; filename="$request_basename"';
}
}