Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: object has no attribute 'extent' #247

Open
hemache opened this issue Nov 5, 2020 · 0 comments · May be fixed by #246
Open

AttributeError: object has no attribute 'extent' #247

hemache opened this issue Nov 5, 2020 · 0 comments · May be fixed by #246

Comments

@hemache
Copy link

hemache commented Nov 5, 2020

Hello,

GeoFeatureModelSerializer fails to get bounding box when geo_field points to a SerializerMethodField

AttributeError: object has no attribute 'extent'

Example:

class PlaceSerializer(GeoFeatureModelSerializer):
    location = GeometrySerializerMethodField()

    class Meta:
        model = Location
        fields = ["name"]
        id_field = "pk"
        geo_field = "location"
        auto_bbox = True

    def get_location(self, obj):
        return obj.location.transform(4326, clone=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant