DataSources ----------- A DataSource is a backend data datasource. These data datasources provide persistent storage for features. 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. The OGR layer requires a 'dsn' property and a 'layer' property. In many cases, the layer is part of the DSN. An example OGR configuration might look like: :: [myshape] type=OGR dsn=/home/example/myshape.shp layer=myshape attribute_cols=name,some_interesting_column #optional; only these columns will be returned. Dependencies: * OGR * ogr Python bindings DBM === The DBM datasource uses anydbm combined with pickle to store features in a file on disk. It should work on any platform. A sample DBM configuration might look like: :: [scribble] type=DBM file=/home/example/scribble.db Depending on the system on which it is running, the internals of this database may be different. Dependencies: * None DBM Extra Features: * Allows for non-fixed attribute schemas: every feature can have a different set of attributes. * Allows for the setting of a 'unique' property on the layer. If unique is set, features will be 'merged' based on this key on creation, instead of a new feature being created. PostGIS ======= The PostGIS datasource implements a direct connection to PostGIS. This datasource requires a dsn parameter and a layer parameter. It also accepts a variety of optional parameters, some of which you may need to override the default value of, depending on your schema. Please see the example below for details. A sample PostGIS configuration might look like: :: [mylayer] type=PostGIS dsn=host=localhost dbname=mydata user=myuser password=1234 layer=mylayer fid=gid #defaults to ogc_fid geometry=wkb_geometry # defaults to the_geom srid=26910 #defaults to 4326 encoding=utf-8 #defaults to utf-8 attribute_cols=name,some_interesting_column #optional order=cost #optional Dependencies: * psycopg or psycopg2 SQLite ====== A simple SQLite datasource that can be used on any website with Python support for SQLite. Creates 2 tables for each layer: one for the features, and one for any attributes/properties pertaining to those features. The features table can be used as input to OGR. A sample SQLite layer configuration might look like: :: [lines] type=SQLite file=/home/example/features.sqlite # if already exists, features table will be added layer=lines # name of table; defaults to layer name [points] type=SQLite file=/home/example/features.sqlite Dependencies: * None under Python2.5 * pysqlite2 under Python2.4 WFS === The WFS datasource implements read-only access to WFS servers. Required parameters are: * url * typename A sample WFS layer configuration might look like: :: [wfs] type=WFS url=http://zuluviz.sdsu.edu:8080/geoserver/wfs typename=topp:states Dependencies: * OGR * ogr Python bindings Flickr ====== The Flickr datasource loads data from geotagged Flickr photos. Filtering the results can be done by using any of the parameters listed at: http://flickr.com/services/api/flickr.photos.search.html For example, a Flickr source limited to all photos which match all the tags 'mit', 'food', '2007' from the user with ID '56541240@N00':: [flickr] type=Flickr user_id=56541240@N00 tags=mit,food,2007 tag_mode=all By default, this only shows public photos. To grant the datasource access to your non-public photos, you must fetch a 'read' permissions token from the API. You can use the Flickr.py as a command line application to do this: $ ./FeatureServer/DataSource/Flickr.py Open the following URL in a browser: http://flickr.com/services/auth/?api_key=[...]&perms=read&frob=[...] Press enter when complete. The result of this will be something like: Your token is: 721576-5d6044 Add the following line to a Flickr data source to complete configuration: auth_token=721576-5d6044 With this example, a Flickr datasource would look like: :: [flickr] type=Flickr user_id=56541240@N00 auth_token=721576-5d6044 Twitter ======= Powered by Twittervision, the twitter datasource lets you use twittervision's API to display the current location of a user. Very simplistic, doesn't do much. :: [twitter-crschmidt] type=Twitter username=crschmidt OSM === Allows for requests to hit the OpenStreetMap API to request data. No configuration necessary. Only supports query-by-bounding-box and query-by-id: the latter will only search for 'ways', not nodes or relations. Relations are not handled at all. It is possible to add an 'osmxapi=yes' option. This will use the OSM Extended API instead of the main API. This API may be several hours out of date, but it does allow attribute queries: see http://wiki.openstreetmap.org/index.php/Osmxapi . It does not support ID queries, and if one is sent, it will instead be redirected to the main API. :: [osm] type=OSM osmxapi=no GeoAlchemy ========== GeoAlchemy is an extension of SQLAlchemy, the python database toolkit, for spatial databases. GeoAlchemy datasource for FeatureServer allows you to access features stored in one of the supported spatial databases. As the moment GeoAlchemy supports PostGIS, MySQL and Spatialite. The actual geoalchemy model definition may lie in a separate package. This makes it easy to integrate feature server with other applications / frameworks. A basic GeoAlchemy configuration might look like: :: [mylayer] type=GeoAlchemy dburi=postgres://user:password@dbhost/dbname model=mypackage.mymodule cls=MyLayer fid=id geometry=geom # defaults to the_geom Instead of using dburi in the config it is possible to pass the sqlalchemy session to the datasource. Developers using the FeatureServer API may choose to pass the session object instead. GeoAlchemy also supports the use of relations where the geometry column may be in a related table. The config in this would be :: [mylayerexterior] type=GeoAlchemy dburi=postgres://user:password@dbhost/dbname model=mypackage.mymodule cls=MyLayer fid=id geometry=geom # defaults to the_geom geom_cls=Exterior geom_rel=exterior Dependencies: * SQLAlchemy * Python DBAPI library of the specific database used