From the OSGeo4W Shell
ogr2ogr -f PostgreSQL PG:"dbname=postgis host=localhost user=postgres password=postgres" -a_srs "EPSG:27700" county_region.shp -nlt MULTIPOLYGON
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: |
// Bounding box of our TMS that define our area of interest | |
var bbox = [-600000, -300000, 1300000, 1600000]; | |
// Resolutions of our TMS that the tiles will be displayed at calculated so | |
// that at resolution 0 the bounds fit one 256x256 tile: (maxx - minx)/256 | |
var res = [7421.875, 3710.9375, 1855.46875, 927.734375]; | |
// Define the Proj4Leaflet coordinate reference system base on British National Grid | |
var crs = L.CRS.proj4js( | |
'EPSG:27700', |
import itertools | |
import qgis | |
from qgis.gui import QgsMessageBar | |
from qgis.core import QgsMapLayer | |
def layer_info(layer): | |
print "Layer name: %s" % layer.name() | |
print "CRS: %s" % layer.crs().authid() | |
print "Extent: %s" % layer.extent().asWktCoordinates() |
# Just the selected features | |
layer = iface.activeLayer() | |
for feature in layer.selectedFeatures(): | |
print feature['name'] | |
# Filter by current extent of the map | |
extent = iface.mapCanvas().extent() | |
request = QgsFeatureRequest() | |
request.setFilterRect(extent) | |
layer = iface.activeLayer() |
;; fizzbuzz without conditionals in Clojure | |
; Simple patten matching using a single map lookup | |
(defn fizzbuzz [x] | |
(let [v [(= (mod x 3) 0) (= (mod x 5) 0)]] | |
({[true false] "fizz" | |
[false true] "buzz" | |
[true true] "fizzbuzz" | |
[false false] x} v))) |
""" Minimal MapProxy Middleware demonstrating wrapping MapProxy and working | |
with the query string | |
To run: | |
1. Install MapProxy in a virtual enviroment together with Gunicorn | |
2. Create a basic MapProxy config and copy this file into the same directory as mapproxy.yaml | |
2. Activate virtual environment | |
3. Change to the directory containing this file | |
4. Run: | |
gunicorn -k eventlet --workers=1 --log-file=- mapproxy_filter:application |
// OpenLayers. See https://openlayers.org/ | |
// License: https://raw.githubusercontent.com/openlayers/openlayers/master/LICENSE.md | |
// Version: v4.5.0-70-gfca0b07 | |
;(function (root, factory) { | |
if (typeof exports === "object") { | |
module.exports = factory(); | |
} else if (typeof define === "function" && define.amd) { | |
define([], factory); | |
} else { | |
root.ol = factory(); |
var R = require('ramda'); | |
var states = [ | |
{symbol: 'CT', name: 'Connecticut', pop: 3574097}, | |
{symbol: 'ME', name: 'Maine', pop: 1328361}, | |
{symbol: 'MA', name: 'Massachusetts', pop: 6547629}, | |
{symbol: 'NH', name: 'New Hampshire', pop: 1316470}, | |
{symbol: 'RI', name: 'Rhode Island', pop: 1052567}, | |
{symbol: 'VT', name: 'Vermont', pop: 623741}, | |
]; |
function escapeAsCsv(str) { | |
// Double up double quotes and quote the entire string if necessary | |
if (str.includes(',') || str.includes('\n') || str.includes('"')) { | |
return '"' + str.replace(/"/g, '""') + '"'; | |
} | |
return str; | |
} | |
// Export Confluence table as CSV | |
// Select the tbody element in Chrome devtools Elements panel then run the |