Coder Social home page Coder Social logo

couchmaps's Introduction


Overview

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.


Requirements

  1. 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.

  1. GDAL trunk

http://svn.osgeo.org/gdal/trunk

  1. MapServer trunk with CouchDB wrapper

[email protected]: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

  1. 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

  1. Populate database

ogr2ogr -f couchdb -lco "UPDATE_PERMISSIONS=ALL" "couchdb:http://localhost:8000" bcpos_trails.shp

  1. 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.

  1. Test WFS GetCapabilities

http://host:8000/mapserver/_mapserv/sample.map?request=getcapabilities&service=wfs&version=1.0.0

  1. 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

curl "http://host:8000/mapserver/_mapserv/sample.map?SERVICE=WFS&VERSION=1.0.0&REQUEST=getfeature&TYPENAME=BoulderOpenSpace&MAXFEATURES=100"

The geojson data in CouchDB (step 6) is now returned as GML

  1. Test WMS GetMap

http://host:8000/mapserver/_mapserv/sample.map?REQUEST=GetMap&SERVICE=WMS&VERSION=1.1.1&LAYERS=BoulderOpenSpace&STYLES=&FORMAT=image/tiff&SRS=EPSG:4326&WIDTH=400&HEIGHT=300&BBOX=-105.54,39.9138,-105.072,40.2608

and open up the returned geotiff to see a rendering of the geojson data in (6).

couchmaps's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

couchmaps's Issues

is this already active? some practical use case?

hello Norman.

I cannot find more info about this tool than here, so I wonder if it is still active? some successful use case and code from which to start? it would be very very helpful.

I am managing a dataset of about 15 milion records about biodiversity, each record with more than 30 columns that I want to filter with user demands. With postGIS it is becoming really slow and we are wondering if GeoCouch could help us.

I wanna created several degree grids for the entire world and apply a point-in-polygon to get how many records are in each degree cell. I understand this can be done relatively fast by GeoCouch, but what really worries me is the performance on plotting these geometries on the webmapping app. As we will get back GeoJSONs... let's say 500 'simple' (just degree cells, 4 coords), this would block the browser? (javascript has to transform this json to vectorial data). Currently using postGIS I get back a 300Kb JSON containing 1200 geometries.

So the ideal would be to request Couchdb and get back a WMS image via MapServer...

thanks in advance,

Pere

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.