Skip to main content

django rest framework geojson serializer

DRF geojson serializer is a decorator which allows to format data as geojson http://geojson.org

Quick start

Geojson serializer works with django rest framework as a decorator.

  1. Add django-geojson_serializer to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = [
    ....
    'geojson_serializer'
    ]
  2. In your code you can use geojson_serializer(<name-of-geo-field>) decorator with a regualar serializer, e.g.:

    from geojson_serializer.serializers import geojson_serializer
    
    
    class City(models.Model):
        name = models.CharField(max_length=128)
        location = models.PointField()
    
    
    @geojson_serializer('location')
    class CitySerializer(serializers.ModelSerializer):
        class Meta:
            model = City
            fields =['name', 'location']
    
    
    class CityViewSet(viewsets.ModelViewSet):
        queryset = City.objects.all()
        serializer_class = CitySerializer

    Then you can register CityViewSet with a router and the view will generate and accept geojsons in corresponding requests.

  3. Also supported are id and bbox fields:

    @geojson_serializer('location', id='id', bbox='bounding_box')
    class MySerializer(serializers.ModelSerializer):
    ....

    In this case 'id' and 'bounding_box' fields should be defined by the underlying serializer MySerializer.

Metadata

Release files for django-geojson-serializer 0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-geojson-serializer 0.3
File Size Uploaded Provenance Actions
django-geojson_serializer-0.3.tar.gz 3.6 kB Without provenance Details for django-geojson_serializer-0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-geojson-serializer 0.3
File Interpreter ABI Platform Actions
django_geojson_serializer-0.3-py2-none-any.whl Python 2 none any Details for django_geojson_serializer-0.3-py2-none-any.whl

Total release size: 8.9 kB

Release files / django-geojson_serializer-0.3.tar.gz

Download URL django-geojson_serializer-0.3.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
3795109809776919b220b392eff29281b1b007d7e6b0421351cbe5a9b4022894
BLAKE2b-256 checksum
How to use checksums
65167a390ebf00f97f89d3be1522d8b32021859750e7bc3a00eda3ffcac0498a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.6.5

Release files / django_geojson_serializer-0.3-py2-none-any.whl

Download URL django_geojson_serializer-0.3-py2-none-any.whl
Size 5.3 kB
Tags Python 2
SHA-256 checksum
How to use checksums
375c6519ef8f6cdeba616121dac1783212e8600547cb6bf1415e0779225b5fe5
BLAKE2b-256 checksum
How to use checksums
29f2b1846146ababccc9191b5ec0acfa90c2826ec06b29ba52bb56cab6483bea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.6.5

Security for django-geojson-serializer 0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page