GithubHelp home page GithubHelp logo

ga_ows's Introduction

RENCI Geoanalytics - OGC WFS and WMS

Core to Geoanalytics are the Open Geographic Consortium's Open Web Services. ga_ows is a reusable GeoDjango webapp that provides you the ability to expose GeoDjango models and Python objects as geographic webservices.

A geographic webservice allows you to access data in your GeoDjango models by bounding box and other filters; these data can then be imported into other geographic databases, or perhaps more importantly as layers on a map. For layering WFS services, see the OpenLayers project .

How does it work? OWS is based on Django's class-based generic views. The following in your urls.py will create a WFS service for a the models in your app:

from ga_ows.views.wfs import WFS
from myapp import models as m

urlpatterns = patterns('',

# ...

    url(r'^wfs/?', WFS.as_view(
        models=[m.MyModel1, m.MyModel2], # everything but this is optional.
        title='My app\'s WFS',
        keywords=['some','keywords'],
        fees='one dollar',
        provider_name='RENCI',
        addr_street='100 Europa Dr. ste 529',
        addr_city='Chapel Hill',
        addr_admin_area='NC',
        addr_postcode='27515',
        addr_country='USA',
        addr_email='[email protected]'
    )),

# ...

)

This will create a WFS endpoint at $django_server/$myapp_root/wfs that serves up features in GML and any of the formats that support the creation of single-file dataset in OGR (note that for now this means shapefiles are not supported for output since they require multiple files, although they will be in the near future).

WMS, which renders data to image before returning it to a client, is currently implemented but undocumented. WMS services will change shortly to match the source code model in the WFS implementation as it is much cleaner and easier to support the standard as written. If you are interested in using WMS and don't mind the instabilty of the API, read the documentation in the following modules:

  • ga_ows.rendering.palettes
  • ga_ows.rendering.styler
  • ga_ows.views.wms
  • ga_ows.views.wmsconfig - note in particular this module is likely to go away and change drastically.

Implemented features

Currently implemented in WFS are the following operations, as urlencoded HTTP GET and HTTP POST. XML and SOAP are not supported yet and not high on my priority list at the moment:

  • GetCapabilities
  • DescribeFeatureType1
  • GetFeature
  • ListStoredQueries
  • DescribeStoredQueries

Yet to be implemented features include:

  • Transaction
  • GetFeatureWithLock
  • LockFeature
  • GetPropertyValue
  • CreateStoredQuery
  • DropStoredQuery

If you require transactional features, right now django-tastypie may well cover your needs nicely. It creates RESTful APIs for models instead of using the standard WFS transaction support.

Querying the data

The standard query language is not implemented. Instead, the Django QuerySet query language is supported, including geographic extensions through GeoDjango. In the query parameter, you pass a JSON document containing the query as sets of parameters and JSON serializable values (geometry should be WKT strings in the same SRS as the service's native SRS.). Thus the following filter is valid:

{
    "geom__crosses" : "LINESTRING(0 0, 10 10, 20 30)",
    "entry__gt" : "10/10/2010",
    "speed__gt" : 10
}

Not all Django model queries are supported yet. In particular, referencing model fields and queries that requiree Q() are not yet supported. These will be supported in future versions of ga_ows.

Common return formats

Although nothing is guaranteed, most implementations of OGR contain at least the GeoJSON and GML formats as well as a number of others, often including CSV. For a complete list of formats, check the GetCapabilities document.

Requirements

Because OWS does a lot of heavy lifting, there are a few requirements above and beyond basic GeoDjango:

WFS

  • GDAL
  • lxml
  • psycopg22
  • PostGIS or Spatialite backends (MySQL and Oracle are currently unsupported)
  • django-tastypie (if you want to support transactions)
  • django-model-schemas (for DescribeFeatureType)

WMS

  • as above, but also...
  • pycairo
  • shapely
  • numpy
  • scipy - (yes, really)

Support

Please post issues at github's repository for ga_ows for support.

This file was modified by PyCharm 2.0.1 for binding GitHub repository


  1. DescribeFeatureType requires that you have your models' schema exposed through django-model-schemas

  2. note that Postgres 9.1 users will want to get the patch for psycopg2 described here

ga_ows's People

Contributors

jeffersonheard avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.