Skip to content

Instantly share code, notes, and snippets.

💭
Drinking tea

Matt Walker walkermatt

💭
Drinking tea
View GitHub Profile
@walkermatt
walkermatt / content.ftl
Last active Dec 25, 2015
GeoServer Freemarker template
View content.ftl
<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 Jan 22, 2018
List of geometry type codes that can specified in an ogr gfs file.
View ogr_gfs_geom_types.md

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 Nov 13, 2013
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).
View astun.py
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 Nov 26, 2013
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.
View a.gml
<?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 Aug 29, 2015
Toy map / reduce functions in JavaScript
View map_reduce.js
// 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 Aug 29, 2015
GNU Parallel all the things!
View loader_parallel.sh
find /var/data/osmm/ -type f -print0 | \
parallel -0 python loader.py loader.config "src_dir={}"
@walkermatt
walkermatt / web.config
Created Aug 15, 2014
Enable CORS IIS7
View web.config
<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 Aug 29, 2015
Location map for OSGIS 2014
View osgis.geojson
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 Aug 29, 2015
Set up OSGeo Live Xubuntu instance for OL3 & Leaflet workshop
View osgeolive.sh
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 Dec 20, 2016 — 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.
View ObjectifyJSONEncoder.py
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:
You can’t perform that action at this time.