Skip to content

Instantly share code, notes, and snippets.

View pbabik's full-sized avatar

Michał Mackiewicz pbabik

View GitHub Profile
@pbabik
pbabik / getfeature.php
Created March 21, 2012 10:22 — forked from bmcbride/postgis_geojson.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)*