Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
import sqlite3 as sqlite
import os
import sys
import time
# Extracts an mbtiles database into a pyramid structure
if len(sys.argv) != 2:
@mantesat
mantesat / postgis_geojson.php
Created March 28, 2016 09:49 — 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*