django-gisserver


Namedjango-gisserver JSON
Version 1.3.0 PyPI version JSON
download
home_pagehttps://github.com/amsterdam/django-gisserver
SummaryDjango speaking WFS 2.0 (exposing GeoDjango model fields)
upload_time2024-04-18 12:53:05
maintainerNone
docs_urlNone
authorDiederik van der Boor
requires_python>=3.6
licenseMozilla Public License 2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            [![Documentation](https://readthedocs.org/projects/django-gisserver/badge/?version=latest)](https://django-gisserver.readthedocs.io/en/latest/?badge=latest)
[![Actions](https://github.com/Amsterdam/django-gisserver/actions/workflows/tests.yaml/badge.svg?branch=main)](https://github.com/Amsterdam/django-gisserver/actions/workflows/tests.yaml)
[![PyPI](https://img.shields.io/pypi/v/django-gisserver.svg)](https://pypi.python.org/pypi/django-gisserver)
[![MPL License](https://img.shields.io/badge/license-MPL%202.0-blue.svg)](https://pypi.python.org/pypi/django-gisserver)
[![Coverage](https://img.shields.io/codecov/c/github/amsterdam/django-gisserver/main.svg)](https://codecov.io/github/amsterdam/django-gisserver?branch=main)

# django-gisserver

Django speaking WFS 2.0 to expose geo data.

## Features

* WFS 2.0 Basic implementation.
* GML 3.2 output.
* Standard and spatial filtering (FES 2.0)
* GeoJSON and CSV export formats.
* Extensible view/operations.
* Uses GeoDjango queries for filtering.
* Streaming responses for large datasets.

## Documentation

For more details, see: <https://django-gisserver.readthedocs.io/>


## Quickstart

Install the module in your project:

```bash
pip install django-gisserver
```

Add it to the ``INSTALLED_APPS``:

```python
INSTALLED_APPS = [
    ...
    "gisserver",
]
```

Create a model that exposes a GeoDjango field:

```python
from django.contrib.gis.db.models import PointField
from django.db import models


class Restaurant(models.Model):
    name = models.CharField(max_length=200)
    location = PointField(null=True)

    def __str__(self):
        return self.name
```

Write a view that exposes this model as a WFS feature:

```python
from gisserver.features import FeatureType, ServiceDescription
from gisserver.geometries import CRS, WGS84
from gisserver.views import WFSView
from .models import Restaurant

RD_NEW = CRS.from_srid(28992)


class PlacesWFSView(WFSView):
    """An simple view that uses the WFSView against our test model."""

    xml_namespace = "http://example.org/gisserver"

    # The service metadata
    service_description = ServiceDescription(
        title="Places",
        abstract="Unittesting",
        keywords=["django-gisserver"],
        provider_name="Django",
        provider_site="https://www.example.com/",
        contact_person="django-gisserver",
    )

    # Each Django model is listed here as a feature.
    feature_types = [
        FeatureType(
            Restaurant.objects.all(),
            fields="__all__",
            other_crs=[RD_NEW]
        ),
    ]
```

Use that view in the URLConf:

```python
from django.urls import path
from . import views

urlpatterns = [
    path("/wfs/places/", views.PlacesWFSView.as_view()),
]
```

You can now use http://localhost:8000/wfs/places/ in your GIS application.
It will perform requests such as:

* <http://localhost:8000/wfs/places/?SERVICE=WFS&REQUEST=GetCapabilities&ACCEPTVERSIONS=2.0.0,1.1.0,1.0.0>
* <http://localhost:8000/wfs/places/?SERVICE=WFS&REQUEST=DescribeFeatureType&VERSION=2.0.0&TYPENAMES=restaurant>
* <http://localhost:8000/wfs/places/?SERVICE=WFS&REQUEST=GetFeature&VERSION=2.0.0&TYPENAMES=restaurant&STARTINDEX=0&COUNT=1000&SRSNAME=urn:ogc:def:crs:EPSG::28992>

By adding `&OUTPUTFORMAT=geojson` or `&OUTPUTFORMAT=csv` to the `GetFeature` request, the GeoJSON and CSV outputs are returned.
The CSV output has an unlimited page size, as it's quite performant.



## Why this code is shared

The "datapunt" team of the Municipality of Amsterdam develops software for the municipality.
Much of this software is then published as Open Source so that other municipalities,
organizations and citizens can use the software as a basis and inspiration to develop
similar software themselves. The Municipality of Amsterdam considers it important that
software developed with public money is also publicly available.

This package is initially developed by the City of Amsterdam, but the tools
and concepts created in this project can be used in any city.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/amsterdam/django-gisserver",
    "name": "django-gisserver",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "Diederik van der Boor",
    "author_email": "opensource@edoburu.nl",
    "download_url": "https://files.pythonhosted.org/packages/59/65/82f89fecb2bc3ce927082a08c7d41078d675ab17e70296ea64600a79a591/django-gisserver-1.3.0.tar.gz",
    "platform": null,
    "description": "[![Documentation](https://readthedocs.org/projects/django-gisserver/badge/?version=latest)](https://django-gisserver.readthedocs.io/en/latest/?badge=latest)\n[![Actions](https://github.com/Amsterdam/django-gisserver/actions/workflows/tests.yaml/badge.svg?branch=main)](https://github.com/Amsterdam/django-gisserver/actions/workflows/tests.yaml)\n[![PyPI](https://img.shields.io/pypi/v/django-gisserver.svg)](https://pypi.python.org/pypi/django-gisserver)\n[![MPL License](https://img.shields.io/badge/license-MPL%202.0-blue.svg)](https://pypi.python.org/pypi/django-gisserver)\n[![Coverage](https://img.shields.io/codecov/c/github/amsterdam/django-gisserver/main.svg)](https://codecov.io/github/amsterdam/django-gisserver?branch=main)\n\n# django-gisserver\n\nDjango speaking WFS 2.0 to expose geo data.\n\n## Features\n\n* WFS 2.0 Basic implementation.\n* GML 3.2 output.\n* Standard and spatial filtering (FES 2.0)\n* GeoJSON and CSV export formats.\n* Extensible view/operations.\n* Uses GeoDjango queries for filtering.\n* Streaming responses for large datasets.\n\n## Documentation\n\nFor more details, see: <https://django-gisserver.readthedocs.io/>\n\n\n## Quickstart\n\nInstall the module in your project:\n\n```bash\npip install django-gisserver\n```\n\nAdd it to the ``INSTALLED_APPS``:\n\n```python\nINSTALLED_APPS = [\n    ...\n    \"gisserver\",\n]\n```\n\nCreate a model that exposes a GeoDjango field:\n\n```python\nfrom django.contrib.gis.db.models import PointField\nfrom django.db import models\n\n\nclass Restaurant(models.Model):\n    name = models.CharField(max_length=200)\n    location = PointField(null=True)\n\n    def __str__(self):\n        return self.name\n```\n\nWrite a view that exposes this model as a WFS feature:\n\n```python\nfrom gisserver.features import FeatureType, ServiceDescription\nfrom gisserver.geometries import CRS, WGS84\nfrom gisserver.views import WFSView\nfrom .models import Restaurant\n\nRD_NEW = CRS.from_srid(28992)\n\n\nclass PlacesWFSView(WFSView):\n    \"\"\"An simple view that uses the WFSView against our test model.\"\"\"\n\n    xml_namespace = \"http://example.org/gisserver\"\n\n    # The service metadata\n    service_description = ServiceDescription(\n        title=\"Places\",\n        abstract=\"Unittesting\",\n        keywords=[\"django-gisserver\"],\n        provider_name=\"Django\",\n        provider_site=\"https://www.example.com/\",\n        contact_person=\"django-gisserver\",\n    )\n\n    # Each Django model is listed here as a feature.\n    feature_types = [\n        FeatureType(\n            Restaurant.objects.all(),\n            fields=\"__all__\",\n            other_crs=[RD_NEW]\n        ),\n    ]\n```\n\nUse that view in the URLConf:\n\n```python\nfrom django.urls import path\nfrom . import views\n\nurlpatterns = [\n    path(\"/wfs/places/\", views.PlacesWFSView.as_view()),\n]\n```\n\nYou can now use http://localhost:8000/wfs/places/ in your GIS application.\nIt will perform requests such as:\n\n* <http://localhost:8000/wfs/places/?SERVICE=WFS&REQUEST=GetCapabilities&ACCEPTVERSIONS=2.0.0,1.1.0,1.0.0>\n* <http://localhost:8000/wfs/places/?SERVICE=WFS&REQUEST=DescribeFeatureType&VERSION=2.0.0&TYPENAMES=restaurant>\n* <http://localhost:8000/wfs/places/?SERVICE=WFS&REQUEST=GetFeature&VERSION=2.0.0&TYPENAMES=restaurant&STARTINDEX=0&COUNT=1000&SRSNAME=urn:ogc:def:crs:EPSG::28992>\n\nBy adding `&OUTPUTFORMAT=geojson` or `&OUTPUTFORMAT=csv` to the `GetFeature` request, the GeoJSON and CSV outputs are returned.\nThe CSV output has an unlimited page size, as it's quite performant.\n\n\n\n## Why this code is shared\n\nThe \"datapunt\" team of the Municipality of Amsterdam develops software for the municipality.\nMuch of this software is then published as Open Source so that other municipalities,\norganizations and citizens can use the software as a basis and inspiration to develop\nsimilar software themselves. The Municipality of Amsterdam considers it important that\nsoftware developed with public money is also publicly available.\n\nThis package is initially developed by the City of Amsterdam, but the tools\nand concepts created in this project can be used in any city.\n\n\n",
    "bugtrack_url": null,
    "license": "Mozilla Public License 2.0",
    "summary": "Django speaking WFS 2.0 (exposing GeoDjango model fields)",
    "version": "1.3.0",
    "project_urls": {
        "Homepage": "https://github.com/amsterdam/django-gisserver"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cb612e922b05abe65a6448e85f6681b09d70540a36778687ff34f90eea0f692a",
                "md5": "c6b25687da1c3a94034c2a938f398168",
                "sha256": "e57690c417b57e317b842949f1a723f7e2d5408eeba398a382054311f000045e"
            },
            "downloads": -1,
            "filename": "django_gisserver-1.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c6b25687da1c3a94034c2a938f398168",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 115583,
            "upload_time": "2024-04-18T12:53:03",
            "upload_time_iso_8601": "2024-04-18T12:53:03.723608Z",
            "url": "https://files.pythonhosted.org/packages/cb/61/2e922b05abe65a6448e85f6681b09d70540a36778687ff34f90eea0f692a/django_gisserver-1.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "596582f89fecb2bc3ce927082a08c7d41078d675ab17e70296ea64600a79a591",
                "md5": "df186ffab45a2bec4dddc8bc9e99dd09",
                "sha256": "f12cf21fe87eff769b294c7e15265dccfd2935f79ad61b37dcd09956f37b0a27"
            },
            "downloads": -1,
            "filename": "django-gisserver-1.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "df186ffab45a2bec4dddc8bc9e99dd09",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 100128,
            "upload_time": "2024-04-18T12:53:05",
            "upload_time_iso_8601": "2024-04-18T12:53:05.966399Z",
            "url": "https://files.pythonhosted.org/packages/59/65/82f89fecb2bc3ce927082a08c7d41078d675ab17e70296ea64600a79a591/django-gisserver-1.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-18 12:53:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "amsterdam",
    "github_project": "django-gisserver",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "django-gisserver"
}
        
Elapsed time: 0.24065s