Giter Club home page Giter Club logo

Comments (6)

Gagaro avatar Gagaro commented on August 30, 2024

The documentation looks wrong. And i'm not sure the Deserializer is really tested because it looks like there is an exception which is not imported..

From looking through the tests, I'd say that you would need to do something like:

>>> from django.core import serializers
>>> serializers.deserialize('geojson', your_geojson)

Can you tell me if this works? Thanks.

from django-geojson.

hughstimson avatar hughstimson commented on August 30, 2024

I ran into the same error as @easherma when trying to de-serialize some GeoJSON that was returned from a geocoder API.

I tried @Gagaro's suggestion but it resulted in a different error:

{SerializerDoesNotExist}'geojson is a serialization-only serializer'

That's a pity. So far as I can tell there's no other library that will attempt to nicely convert some valid GeoJSON into a spatially aware Django model. Luckily I'm working with points so it's pretty easy to just parse them out from the JSON. But such a thing could be useful for more complex feature collections.

from django-geojson.

Gagaro avatar Gagaro commented on August 30, 2024

The thing is we do have a deserializer in the tests: https://github.com/makinacorpus/django-geojson/blob/master/djgeojson/tests.py#L69-L131

We also have a Deserializer method, maybe you could try that one: https://github.com/makinacorpus/django-geojson/blob/master/djgeojson/serializers.py#L479-L521

I'm not sure what's up with all this.

from django-geojson.

marco-silva0000 avatar marco-silva0000 commented on August 30, 2024

I haven't been able to use the Deserializer class. Will keep trying though.

This part of the documentation is wrong,
https://django-geojson.readthedocs.io/en/latest/advanced.html#low-level-deserializer

probably outdated right?

from django-geojson.

andybak avatar andybak commented on August 30, 2024

Would be nice to at least fix the docs. This was my first experience of using the whole makinacorpus Geodjango stack and it didn't inspire immediate confidence!

from django-geojson.

erwinfeser avatar erwinfeser commented on August 30, 2024

It seems to be that was never implemented

from django-geojson.

Related Issues (20)

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.