FeatureServer is an implementation of a RESTful Geographic Feature Service. (What is REST?) Using standard HTTP methods, you can fetch a representation of a feature or a collection of features, add new data to the service, or delete data from the service. Use it as an aggregator -- post your GeoRSS feeds to it, and then browse them using WFS. Use it as a translator: use the OGR DataSource to load a shapefile and open it in Google Earth. Use it in any way you like. This software is made available under an open source license by MetaCarta.
Download 1.12: .tar.gz, .zip | Full (with simplejson, wsgiref, paste libraries): .tar.gz, .zip | Changelog | Demo of FeatureServer in OpenLayers | Manual JSON Editing Demo | Upload/Edit KML
To set up your own FeatureServer:
- Download to a web directory that will run CGI.
- Untar the file: tar -zvxf featureserver-.tar.gz
- Visit http://example.com/cgi-bin/featureserver-1.12/featureserver.cgi/scribble/all.gml
- echo '{"id":1, "geometry":{"type":"Point", "coordinates":[[0,5]]}}' | curl -d @- http://example.com/cgi-bin/featureserver-/featureserver.cgi/all.gml
FeatureServer supports multiple methods for input, output, and storage.
DataSource (Storage)
- DBM -- The DBM datasource uses anydbm combined with pickle to store features in a file on disk. This works on any platform, and works right out of the box.
- BerkleyDB -- The BerkleyDB datasource is a subclass of the DBM datasource. It uses a BerkleyDB module for storage.
- PostGIS -- The PostGIS datasource implements a direct connection to PostGIS, allowing for full featured editing/updating.
- WFS -- The WFS datasource implements read-only access to WFS servers.
- OGR -- The OGR datasource allows you to take any OGR datasource -- such as a shapefile, PostGIS database, GML file, or other formats supported by OGR -- and use it as a backend for a FeatureServer layer.
- Flickr -- Load images from flickr.
- OSM -- Load streets from OpenStreetMap by area, id, or key/value pair.
Service (Input/Output)
- GeoJSON -- input and output in the emerging GeoJSON specification. FeatureServer supports GeoJSON Points, Lines, and Polygons with Rings, as both input and output.
- GeoRSS Atom (Simple) -- input and output of Points/Lines/Polygons (no rings/holes) in GeoRSS Simple (Atom). This allows one to take any GeoRSS Simple Atom feed and feed it to FeatureServer for storage.
- KML -- Input and output of Points, Lines, and Polygons from KML.
- GML/WFS -- Output-only support of WFS/GML.
- HTML -- Output-only support of features as HTML files, powered by Cheetah templates.
- OSM -- Output-only support of features as OpenStreetMap '.osm' files. (These files can be opened using JOSM and posted to the OSM server.)
Setup
FeatureServer can be configured to use one of three different server configurations:
- CGI
- mod_python
- Standalone wsgi HTTP server
- FastCGI
REST service
FeatureServer is a RESTful feature server implementation. What does this mean? It means that you use different HTTP methods to interact with the server, rather than creating long URL strings which don't really encapsulate what you want.
Adding data or updating entries in FeatureServer is done in a RESTful manner. Rather than create a long URL string, features can be retrieved by a URL identified by their ID and the output format as an extension, a la:
http://example.com/featureserver.cgi/scribble/1.atom
http://example.com/featureserver.cgi/scribble/1.kml
http://example.com/featureserver.cgi/scribble/1.gml
http://example.com/featureserver.cgi/scribble/1.json
To create data, simply POST GeoJSON, KML, or GeoRSS to the service:
curl -d @content-file http://example.com/featureserver.cgi/layer/create.json
To delete, use the DELETE method on the feature you wish to remove:
curl -X DELETE http://example.com/featureserver.cgi/layer/1.json
For querying you often want a subset of features: you can specify a maximum number of features using maxfeatures, bbox, or using the queryable attribute to specify a list of parameters which should be used for attribute queries:
http://example.com/featureserver.cgi/simple?bbox=-180,-90,0,0
http://example.com/featureserver.cgi/simple?maxfeatures=10
http://example.com/featureserver.cgi/simple?queryable=title,description&title=My%20Feature&description=Fun