A simple wrapper around MapServer (http://mapserver.org/) to enable
- MapServer map files to be written in JSON and stored in CouchDB
- MapServer to be managed and run in an Erlang OTP supervision process
- GDAL CouchDB OGR driver to serve GeoJSON directly from CouchDB as a WFS or rendered through WMS
MapServer is an Open Source platform for publishing spatial data and interactive mapping applications to the web.
- Couchbase trunk
https://github.com/couchbase/couchdb-manifest (I used the preview branch and set up rake / ruby using RVM)
(currently GeoCouch uses couch_file:flush which isn't in couchdb trunk yet)
GDAL OGR couchdb driver can perform client side filtering, however in ogrcouchdbtablelayer if couchdb isn't present then the error is written to stderr which causes MapServer to raise an error.
- GDAL trunk
http://svn.osgeo.org/gdal/trunk
- MapServer trunk with CouchDB wrapper
git@github.com:normanb/mapserver.git
browse here https://github.com/normanb/mapserver/tree/master/mapserver
Configure as follows
./configure --with-wms --with-wfs --with-wcs --with-gdal --with-ogr --with-proj --with-couchdb
- Configuration
Edit config/couchmaps.ini and copy to local.d and add couchmaps ebin files to path
alternatively
mkdir $COUCH_HOME/build/lib/couchdb/plugins/couchmaps/ebin
and copy beam files there.
note: currently map files are writting to tmp, but this can be override with a mapserver section in the ini file
e.g.
[mapserver]
tmp = /myothertmp
- Populate database
ogr2ogr -f couchdb -lco "UPDATE_PERMISSIONS=ALL" "couchdb:http://localhost:8000" bcpos_trails.shp
- Create a database called mapserver
Add sample mapserver map
curl -X PUT --data-binary @sample.map http://localhost:8000/mapserver/_mapserv/sample.map
this will convert the sample.map in mapfile format to JSON.
Note you can lock down http client browsing of sample.map with a redirect in couchdb that will not affect server operation.
- Test WFS GetCapabilities
http://host:8000/mapserver/_mapserv/sample.map?request=getcapabilities&service=wfs&version=1.0.0
- Test WFS GetFeature
if using geocouch, then test directly first
curl "http://host:8000/bcpos_trails/_design/ogr_spatial/_spatial/spatial?bbox=-180,-90,180,90"
then
The geojson data in CouchDB (step 6) is now returned as GML
- Test WMS GetMap
and open up the returned geotiff to see a rendering of the geojson data in (6).