Skip to content

Instantly share code, notes, and snippets.

View thanhleviet's full-sized avatar
🤗
Focusing

Thanh Lee thanhleviet

🤗
Focusing
View GitHub Profile
@thanhleviet
thanhleviet / install-mapnik2.md
Created January 14, 2012 05:13 — forked from cspanring/install-mapnik2.md
Mapnik2 on Ubuntu 10.04 installation

Mapnik2 on Ubuntu 10.04 installation

http://trac.mapnik.org/wiki/UbuntuInstallation

sudo apt-get install -y g++ cpp \
python-dev libxml2 libxml2-dev \
libfreetype6 libfreetype6-dev \
libjpeg62 libjpeg62-dev \
libltdl7 libltdl-dev \
libpng12-0 libpng12-dev \
@thanhleviet
thanhleviet / render.sh
Created February 20, 2012 15:24 — forked from onyxfish/render.sh
How to generate tiles from TileMill config (ie. bypass mbtiles)
/TileMill/bin/carto map.mml > map.xml
python render_tiles.py map.xml .tiles/ 42.05 -88 41.6 -87.5 11 16 2
@thanhleviet
thanhleviet / __geo_interface__.rst
Created March 28, 2012 07:08 — forked from sgillies/geo_interface.rst
A Python Protocol for Geospatial Data

Author: Sean Gillies

Abstract

This document describes a GeoJSON-like protocol for geospatial vector data.

Introduction

@thanhleviet
thanhleviet / nginx play
Created April 25, 2012 03:40 — forked from sim51/nginx play
My nginx configuration for opendata-map.org
server {
listen 80;
server_name www.opendata-map.org;
root /var/www/opendata-map.org;
access_log /var/log/nginx/opendata-map.access.log;
error_log /var/log/nginx/opendata-map.error.log debug;
# GEOSERVER PROXY & CACHE
location /geoserver {
proxy_pass http://127.0.0.1:8080/geoserver;
@thanhleviet
thanhleviet / nginx play
Created July 3, 2012 08:57 — forked from sim51/nginx play
My nginx configuration for opendata-map.org
server {
listen 80;
server_name www.opendata-map.org;
root /var/www/opendata-map.org;
access_log /var/log/nginx/opendata-map.access.log;
error_log /var/log/nginx/opendata-map.error.log debug;
# GEOSERVER PROXY & CACHE
location /geoserver {
proxy_pass http://127.0.0.1:8080/geoserver;
@thanhleviet
thanhleviet / geoserver.conf
Created July 3, 2012 15:30
Setting up proxy for geoserver with nginx
Tested on nginx version 1.1.9, ubuntu 12.04
-Command lines in order:
sudo touch /etc/nginx/site-availables/geoserver.conf
sudo vi /etc/nginx/site-availables/geoserver.conf
sudo ln -s /etc/nginx/site-availables/geoserver.conf /etc/nginx/site-enabled/geoserver.conf
sudo service nginx start
Content of geoserver.conf
server {
@thanhleviet
thanhleviet / views.py
Created July 4, 2012 07:25 — forked from albertsun/views.py
geojson tiles views.py
from redistricting.apps.features.models import CensusBlock, CensusTract, CensusCounty, DataBlock
from redistricting.utils import gmerc
from django.http import HttpResponse, Http404, HttpResponseForbidden
from django.contrib.gis.geos import GEOSGeometry
from django.shortcuts import render_to_response
from django.template.loader import render_to_string
from django.template import RequestContext
L.TileLayer.TileJSON = L.TileLayer.Canvas.extend({
options: {
debug: false
},
tileSize: 256,
initialize: function (options) {
L.Util.setOptions(this, options);
@thanhleviet
thanhleviet / SearchAndReplace
Created July 6, 2012 07:42
Field calculator to search and replace string field.
def SearchAndReplace(field):
global giatri
if field.find("Huyện") <> -1:
giatri= field.replace("Huyện","H.")
elif field.find("Huyên") <> -1:
giatri =field.replace("Huyên","H.")
elif field.find("Thị Xã") <> -1:
giatri= field.replace("Thị Xã","TX.")
elif field.find("Thị xã") <> -1:
giatri= field.replace("Thị xã","TX.")
@thanhleviet
thanhleviet / PostGIS201.sh
Created July 11, 2012 04:53 — forked from Tab3r/PostGIS201.sh
PostGIS 2.0.1 in Ubuntu 12.04
sudo apt-get install build-essential postgresql-9.1 postgresql-server-dev-9.1 libxml2-dev proj libjson0-dev xsltproc docbook-xsl docbook-mathml gettext postgresql-contrib-9.1 pgadmin3
sudo apt-add-repository ppa:olivier-berten/geo
sudo apt-get update
sudo apt-get install libgdal-dev
# Its looks like:
# $ gdal-config --version
# 1.9.0
# $ geos-config --version