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
;; 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))) |
# 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() |
// 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 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: |
# 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 = { |
MapInfo requires a mapinfo.mapinfo_mapcatalog
relation to be present in a PostGIS database in order to load relations. The spatialtype
column is a float which indicates the geometry type of the relation:
19.0 = POINT, MULTIPOINT
19.1 = LINESTRING, MULTILINESTRING
19.2 = POLYGON, MULTIPOLYGON
19.3 = GEOMETRY
<?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> |
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', |