Skip to content

Instantly share code, notes, and snippets.

@oscarfonts
oscarfonts / gdal_ecw.sh
Created February 3, 2020 11:02 — forked from 1papaya/gdal_ecw.sh
Install GDAL 2.3 with ECW support on Ubuntu 18.04
#!/bin/bash
##
## Tested on: Ubuntu 18.04 & ECW 5.4 & GDAL 2.3.1
##
## Download the ERDAS ECW JP2 SDK v5.4 Linux
## https://download.hexagongeospatial.com/downloads/ecw/erdas-ecw-jp2-sdk-v5-4-linux
## Download GDAL v2.3 Source (ex. 2.3.1)
@oscarfonts
oscarfonts / gdal_ecw.sh
Created February 3, 2020 11:02 — forked from 1papaya/gdal_ecw.sh
Install GDAL 2.3 with ECW support on Ubuntu 18.04
#!/bin/bash
##
## Tested on: Ubuntu 18.04 & ECW 5.4 & GDAL 2.3.1
##
## Download the ERDAS ECW JP2 SDK v5.4 Linux
## https://download.hexagongeospatial.com/downloads/ecw/erdas-ecw-jp2-sdk-v5-4-linux
## Download GDAL v2.3 Source (ex. 2.3.1)
@oscarfonts
oscarfonts / 34M_17.bin
Created August 15, 2018 15:03 — forked from andrewharvey/34M_17.bin
Add 3D model to a Mapbox GL JS map
This file has been truncated, but you can view the full file.
@oscarfonts
oscarfonts / web.xml
Created August 7, 2018 08:29 — forked from essoen/web.xml
CORS * for GeoServer with Tomcat add following to `/var/lib/tomcat7/webapps/geoserver/WEB-INF/web.xml`
<filter>
<filter-name>CorsFilter</filter-name>
<filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
<init-param>
<param-name>cors.allowed.origins</param-name>
<param-value>*</param-value>
</init-param>
<init-param>
<param-name>cors.allowed.methods</param-name>
<param-value>GET,POST,HEAD,OPTIONS,PUT</param-value>
@oscarfonts
oscarfonts / postgresql_quantiles.md
Created May 31, 2018 13:36 — forked from hrwgc/postgresql_quantiles.md
Calculate quantile distributions for PostgreSQL column
SELECT
ntile,
CAST(avg(length) AS INTEGER) AS avgAmount,
CAST(max(length) AS INTEGER)  AS maxAmount,
CAST(min(length) AS INTEGER)  AS minAmount 
FROM (SELECT length, ntile(6) OVER (ORDER BY length) AS ntile FROM countries) x
GROUP BY ntile
ORDER BY ntile;
"""Calculate building floors from the Spanish Cadastre GIS files (SHP).
Once logged, data can be downloaded from https://www.sedecatastro.gob.es/
and the data specification is at
http://www.catastro.minhap.gob.es/ayuda/manual_descriptivo_shapefile.pdf
This python script is to be used in the QGIS 2.x field calculator.
The "CONSTRU" field stores volumetric data and other attributes in the form
of a structured text code. Floor numbers are in roman numerals.
As for example, "-II+IV+TZA" is a building part with two underground floors,
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@oscarfonts
oscarfonts / serializers.py
Last active August 29, 2015 14:11 — forked from yellowcap/serializers.py
Django-parler and Django REST Framework integration
class ParlerModelSerializer(serializers.ModelSerializer):
"""https://gist.github.com/yellowcap/81c6d5f3ea1426689c80"""
def __init__(self, *args, **kwargs):
# Get list of translated fields
fields = self.Meta.model._parler_meta._fields_to_model
# Separate parler fields and scilent fields
parler_fieds = [x for x in self.Meta.fields if x in fields]
pas_parler_fields = [x for x in self.Meta.fields if x not in fields]
@oscarfonts
oscarfonts / install-postgis.sh
Created February 27, 2012 12:10 — forked from rolo/gist:1481128
Install Postgres 9.1, PostGIS and create PostGIS template on Ubuntu 11.10
#!/bin/bash
# Install Postgres 9.1 and PostGIS
sudo apt-get install postgresql-9.1 postgresql-9.1-postgis
# create template_postgis
sudo su postgres -c'createdb -E UTF8 -U postgres template_postgis'
sudo su postgres -c'createlang -d template_postgis plpgsql;'
sudo su postgres -c'psql -U postgres -d template_postgis -c"CREATE EXTENSION hstore;"'
sudo su postgres -c'psql -U postgres -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql'