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
npx @marp-team/marp-cli --template bare -o ol-layerswitcher-typescript.html presentation.md |
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 |
// 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(); |
""" 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 |
# 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() |
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() |
# Rock, paper, scissors | |
def beats(thing1, thing2): | |
""" Determine who wins rock, paper, scissors | |
by passing each players choice """ | |
if thing1 == thing2: | |
# Draw, both players chose the same thing | |
return None | |
# Determine which thing beats thing2 | |
victors = { |
""" Minimal MapProxy Middleware demonstrating the decorate_img API | |
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_decorate:application |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<title>OpenLayers 3 - LayerSwitcher & Popup</title> | |
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width"> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.17.1/ol.css" /> | |
<link rel="stylesheet" href="https://rawgit.com/walkermatt/ol3-layerswitcher/master/src/ol3-layerswitcher.css" /> | |
<link rel="stylesheet" href="https://rawgit.com/walkermatt/ol3-layerswitcher/master/examples/layerswitcher.css" /> | |
<link rel="stylesheet" href="https://rawgit.com/walkermatt/ol3-popup/master/src/ol3-popup.css" /> |