Skip to content

Instantly share code, notes, and snippets.

Alex Davies-Moore schoenobates

  • Devork
Block or report user

Report or block schoenobates

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@schoenobates
schoenobates / main.go
Created Oct 5, 2019
Convert an ASCII DEM File to RAW or PNG for import into other apps (e.g. Unity)
View main.go
package main
import (
"bufio"
"encoding/binary"
"flag"
"fmt"
"image"
"image/color"
"image/png"
@schoenobates
schoenobates / Poly.java
Created Apr 22, 2016
WKT Polygon Regex Validator: Whitespace and First/Last point validation in linear ring... needs to check for more than one two points per linear ring
View Poly.java
POLYGON\s*\(\s*(\(\s*(?<X>\-?\d+(:?\.\d+)?)\s+(?<Y>\-?\d+(:?\.\d+)?)(?:\s*,\s*\-?\d+(:?\.\d+)?\s+\-?\d+(:?\.\d+)?)*\s*,\s*\k<X>\s+\k<Y>\s*\))(\s*,\s*\(\s*(?<XH>\-?\d+(:?\.\d+)?)\s+(?<YH>\-?\d+(:?\.\d+)?)(?:\s*,\s*\-?\d+(:?\.\d+)?\s+\-?\d+(:?\.\d+)?)*\s*,\s*\k<XH>\s+\k<YH>\s*\))*\s*\)
@schoenobates
schoenobates / ogr.go
Last active Jan 17, 2016
Example of using OGR APIs from Go
View ogr.go
package main
/*
#include <stdio.h>
#include <stdlib.h>
#include "gdal_version.h"
#include "ogr_api.h"
#cgo darwin pkg-config: gdal
#cgo linux pkg-config: gdal
@schoenobates
schoenobates / epsg.27701.sql
Created Nov 5, 2015
Add NAD Grid for EPSG 27700
View epsg.27701.sql
INSERT into
spatial_ref_sys (srid, auth_name, auth_srid, proj4text, srtext)
values (
27701, 'custom', 27701,
'+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs +nadgrids=/usr/local/share/osgb/OSTN02_NTv2.gsb',
'PROJCS["OSGB 1936 / British National Grid NAD Grid Extension",GEOGCS["OSGB 1936",DATUM["OSGB_1936",SPHEROID["Airy 1830",6377563.396,299.3249646,AUTHORITY["EPSG","7001"]],TOWGS84[446.448,-125.157,542.06,0.15,0.247,0.842,-20.489],EXTENSION["PROJ4_GRIDS","/usr/local/share/osgb/OSTN02_NTv2.gsb"],AUTHORITY["EPSG","6277"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4277"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",49],PARAMETER["central_meridian",-2],PARAMETER["scale_factor",0.9996012717],PARAMETER["false_easting",400000],PARAMETER["false_northing",-100000],UNIT["Meter",1]]'
);
@schoenobates
schoenobates / osgb.go
Created May 15, 2015
Using Golang with Proj4 to convert between OSGB and WGS84 (both to and from)
View osgb.go
package main
/*
#cgo LDFLAGS: -lproj
#include <string.h>
#include <proj_api.h>
*/
import "C"
import (
"fmt"
@schoenobates
schoenobates / gp-autocomplete.js
Created Nov 16, 2014
Fix for Google AutoComplete Places Javascript API on iOS
View gp-autocomplete.js
var autoElm = document.getElementById('elm-name');
autocomplete = new google.maps.places.Autocomplete(autoElm);
google.maps.event.addListener(autocomplete, 'place_changed', function () {
var place = autocomplete.getPlace();
if (!place.geometry) {
return;
}
instance.setCenter(place.geometry.location);
instance.setZoom(19);
@schoenobates
schoenobates / jooq.gradle
Created Jun 19, 2014
JOOQ Generator Gradle
View jooq.gradle
import org.jooq.util.jaxb.*
import org.jooq.util.*
ext.db = [
url: 'jdbc:postgresql://host/db',
user: 'user',
password: 'user',
schema: 'schema'
]
@schoenobates
schoenobates / DroidFileIdentifier.java
Created Nov 29, 2012
National Archives DROID embed
View DroidFileIdentifier.java
import uk.gov.nationalarchives.droid.core.BinarySignatureIdentifier;
import uk.gov.nationalarchives.droid.core.SignatureParseException;
import uk.gov.nationalarchives.droid.core.interfaces.IdentificationRequest;
import uk.gov.nationalarchives.droid.core.interfaces.IdentificationResult;
import uk.gov.nationalarchives.droid.core.interfaces.IdentificationResultCollection;
import uk.gov.nationalarchives.droid.core.interfaces.RequestIdentifier;
import uk.gov.nationalarchives.droid.core.interfaces.resource.FileSystemIdentificationRequest;
import uk.gov.nationalarchives.droid.core.interfaces.resource.RequestMetaData;
import java.io.File;
@schoenobates
schoenobates / monos.js
Created Oct 3, 2012
MongoDB scripts for WGS84 -> OSGB conversions on the server side
View monos.js
/*
--------------------------------------------------------------------------------------------------------------------
EXTENSIONS
--------------------------------------------------------------------------------------------------------------------
*/
/** Converts numeric degrees to radians */
if (typeof Number.prototype.toRad == 'undefined') {
Number.prototype.toRad = function () {
return this * Math.PI / 180;
@schoenobates
schoenobates / OSGB.java
Created Aug 28, 2012
WGS-84 to OSGB36 Coords Conversion
View OSGB.java
/**
* Java based conversion of Chris Veness' scripts for Lat/Lon WG84 to OSGB36 coords
*
* http://www.movable-type.co.uk/scripts/latlong-convert-coords.html
* (c) Chris Veness 2005-2010 Released under an LGPL license
* http://www.fsf.org/licensing/licenses/lgpl.html
*
*/
public class OSGB {
You can’t perform that action at this time.