Skip to content

Instantly share code, notes, and snippets.

@walkermatt
walkermatt / content.ftl
Last active December 25, 2015 22:49
GeoServer Freemarker template
<ul>
<#list features as feature>
<li><h2>${feature.type.title}</h2>
<ul>
<#list feature.attributes as attribute>
<#if !attribute.isGeometry>
<li>${attribute.name?replace("_", " ", "i")?cap_first}:
<#if attribute.value?starts_with('http')>
<a href="${attribute.value}">${attribute.value}</a>
<#else>
@walkermatt
walkermatt / ogr_gfs_geom_types.md
Last active October 10, 2023 08:31
List of geometry type codes that can specified in an ogr gfs file.

OGR GFS Geometry Values

The geometry type of a feature class can be specified in a .gfs file used by OGR to map from a GML document to a simple feature schema. The following numbers can be used to specify a specific geometry type:

-2147483647 Point25D
-2147483646 LineString25D
-2147483645 Polygon25D
-2147483644 MultiPoint25D
-2147483643 MultiLineString25D

-2147483642 MultiPolygon25D

@walkermatt
walkermatt / astun.py
Created November 13, 2013 19:52
Example of configuring Astun Tech QGIS-Gazetteer-Plugin (https://github.com/AstunTechnology/QGIS-Gazetteer-Plugin) to use a specific iShare location search (Surrey Heath Borough Council in this instance).
from json import loads
from collections import namedtuple
url = "http://isharemaps.surreyheath.gov.uk/getdata.aspx"
params = {
'type': 'json',
'RequestType': 'LocationSearch',
'gettotals': 'true',
'axuid': '1344265603167',
'mapsource': 'SurreyHeath/AllMaps',
@walkermatt
walkermatt / a.gml
Created November 26, 2013 09:40
Test case to reproduce ogr2ogr error loading feature types with no geometry into PostgreSQL 9.1 / PostGIS 1.5. Sample data has been munged to avoid copyright issues.
<?xml version="1.0"?>
<FeatureCollection osgb="http://www.ordnancesurvey.co.uk/xml/namespaces/osgb" gml="http://www.opengis.net/gml" fid="GDS-1389940-6811" xsi="http://www.w3.org/2001/XMLSchema-instance" xlink="http://www.w3.org/1999/xlink" schemaLocation="http://www.ordnancesurvey.co.uk/xml/namespaces/osgb http://www.ordnancesurvey.co.uk/xml/schema/v7/OSDNFFeatures.xsd">
<description>Ordnance Survey, (c) Crown Copyright. All rights reserved, 2013-10-28</description>
<roadMember>
<Road fid="osgbfoo">
<version>5</version>
<versionDate>2006-02-06</versionDate>
<theme>Road Network</theme>
<changeHistory>
<changeDate>2003-03-13</changeDate>
@walkermatt
walkermatt / map_reduce.js
Last active August 29, 2015 14:01
Toy map / reduce functions in JavaScript
// Define reduce, fn and list are required, init is an optional initial value
// which will be passed to fn with the first item in list
function reduce(fn, list, init) {
var val = init,
start = 0;
if (val === undefined) {
if (list.length > 1) {
val = list[0];
start = 1;
} else {
@walkermatt
walkermatt / loader_parallel.sh
Last active August 29, 2015 14:04
GNU Parallel all the things!
find /var/data/osmm/ -type f -print0 | \
parallel -0 python loader.py loader.config "src_dir={}"
@walkermatt
walkermatt / web.config
Created August 15, 2014 10:28
Enable CORS IIS7
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="Accept,Content-Type,X-Requested-With" />
</customHeaders>
</httpProtocol>
</system.webServer>
@walkermatt
walkermatt / osgis.geojson
Last active August 29, 2015 14:05
Location map for OSGIS 2014
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@walkermatt
walkermatt / osgeolive.sh
Last active August 29, 2015 14:05
Set up OSGeo Live Xubuntu instance for OL3 & Leaflet workshop
setxkbmap gb && sudo apt-get install git-core gedit && cd && git clone https://github.com/AstunTechnology/osgis-ol3-leaflet.git ; cd osgis-ol3-leaflet ; gedit ol3/ol3.js & firefox http://astuntechnology.github.io/osgis-ol3-leaflet/ &
@walkermatt
walkermatt / ObjectifyJSONEncoder.py
Last active December 20, 2016 17:29 — forked from aisipos/objectifiedJson.py
JSON encoder that can handle simple lxml objectify types, based on the original: https://gist.github.com/aisipos/345559, extended to accommodate encoding child nodes with the same tag name as a list.
import json
import lxml
from lxml import objectify
class ObjectifyJSONEncoder(json.JSONEncoder):
""" JSON encoder that can handle simple lxml objectify types,
based on the original: https://gist.github.com/aisipos/345559, extended
to accommodate encoding child nodes with the same tag name as a list.
Usage: