Skip to content

Instantly share code, notes, and snippets.

@ns-1m
ns-1m / sqlite_geojson.php
Created April 3, 2012 02:56 — forked from bmcbride/sqlite_geojson.php
PHP SQLite to GeoJSON
<?php
/**
* SQLite to GeoJSON (Requires https://github.com/phayes/geoPHP)
* Query a SQLite table or view (with a WKB GEOMETRY field) and return the results in GeoJSON format, suitable for use in OpenLayers, Leaflet, etc.
*
* @param string $geotable The SQLite table name *REQUIRED*
* @param string $geomfield The WKB GEOMETRY field *REQUIRED*
* @param string $fields Fields to be returned *OPTIONAL (If omitted, all fields will be returned)*
* @param string $parameters SQL WHERE clause parameters *OPTIONAL*
* @param string $orderby SQL ORDER BY constraint *OPTIONAL*
@ns-1m
ns-1m / postgis_geojson.php
Created April 3, 2012 22:54 — forked from bmcbride/postgis_geojson.php
PHP PostGIS to GeoJSON
<?php
/**
* PostGIS to GeoJSON
* Query a PostGIS table or view and return the results in GeoJSON format, suitable for use in OpenLayers, Leaflet, etc.
*
* @param string $geotable The PostGIS layer name *REQUIRED*
* @param string $geomfield The PostGIS geometry field *REQUIRED*
* @param string $srid The SRID of the returned GeoJSON *OPTIONAL (If omitted, EPSG: 4326 will be used)*
* @param string $fields Fields to be returned *OPTIONAL (If omitted, all fields will be returned)* NOTE- Uppercase field names should be wrapped in double quotes
* @param string $parameters SQL WHERE clause parameters *OPTIONAL*
@ns-1m
ns-1m / getfeature.php
Created April 4, 2012 01:06 — forked from pbabik/getfeature.php
PHP PostGIS to GeoJSON - with BBOX query
<?php
/**
* PostGIS to GeoJSON
* Query a PostGIS table or view and return the results in GeoJSON format, suitable for use in OpenLayers, Leaflet, etc.
*
* @param string $bbox Bounding box of request *REQUIRED*
* @param string $geotable The PostGIS layer name *REQUIRED*
* @param string $geomfield The PostGIS geometry field *REQUIRED*
* @param string $srid The SRID of the returned GeoJSON *OPTIONAL (If omitted, EPSG: 4326 will be used)*
* @param string $fields Fields to be returned *OPTIONAL (If omitted, all fields will be returned)* NOTE- Uppercase field names should be wrapped in double quotes
@ns-1m
ns-1m / postgistogeojson.js
Created April 4, 2012 13:44 — forked from samgiles/postgistogeojson.js
A function that converts a PostGIS query into a GeoJSON object.
/*
* A function that converts a PostGIS query into a GeoJSON object.
* Copyright (C) 2012 Samuel Giles <sam@sam-giles.co.uk>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@ns-1m
ns-1m / TileLayer.Bing.js
Created April 8, 2012 20:40 — forked from pagameba/TileLayer.Bing.js
Leaflet Bing layer
/*
* Portions of this code and logic copied from OpenLayers and
* redistributed under the original Clear BSD license terms:
*
* http://trac.osgeo.org/openlayers/browser/license.txt
*
* Copyright 2005-2010 OpenLayers Contributors, released under
* the Clear BSD license. See authors.txt for a list of contributors.
* All rights reserved.
*
config.json:
{
"database": {
"connection": "pg://postgres:postgres@127.0.0.1:5432/test"
},
"web": {
"port": 8000
}
}
@ns-1m
ns-1m / Select_to_Html.js
Created April 11, 2012 01:45 — forked from cfaulkingham/Select_to_Html.js
Convert Select ELement's to Dropdown group
/*!
* Convert <select> elements to Dropdown Group
*
* Author: John Rocela 2012 <me@iamjamoy.com>
* Update: Fixed issue with selected showing value instead of text Colin Faulkingham <colin.faulkingham@gmail.com> 2012
*/
jQuery(function($){
$('select').each(function(i, e){
if (!($(e).data('convert') == 'no')) {
$(e).hide().wrap('<div class="btn-group" id="select-group-' + i + '" />');
@ns-1m
ns-1m / GETfood_blog_hierarchy.json
Created April 15, 2012 03:20 — forked from jazztpt/GETfood_blog_hierarchy.json
GET request returning hierarchy of data
{
"title":"Food",
"articles":
[
{
"url":"http://oursocialbloggingsite.com/api/articles/111",
"title":"Why Food Is Delicious",
"author":"Abe Adams"
},
{
@ns-1m
ns-1m / resources.py
Created April 15, 2012 02:05 — forked from bohde/resources.py
Tastypie support for Geodjango distance filtering
class MyGeoResource(Resource):
def apply_sorting(self, objects, options=None):
if options and "longitude" in options and "latitude" in options:
return objects.distance(Point(options['latitude'], options['longitude'])).order_by('distance')
return super(MyGeoResource, self).apply_sorting(objects, options)
@ns-1m
ns-1m / Spacedust.dvtcolortheme
Created April 15, 2012 05:59
Spacedust Xcode 4 Theme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DVTConsoleDebuggerInputTextColor</key>
<string>0 0 0 1</string>
<key>DVTConsoleDebuggerInputTextFont</key>
<string>Menlo-Bold - 11.0</string>
<key>DVTConsoleDebuggerOutputTextColor</key>
<string>0 0 0 1</string>