3👍
✅
Solved:
Add the srid argument to transform function. I was considering as
transform(srid)
first argument as srid but should be like this
transform(srid=3857)
class MyModelViewSet(viewsets.ModelViewSet):
queryset = MyModel.objects.all().transform(srid=3857)
serializer_class = MyModelSerializer
2👍
You can provide a default SRID to your GeometryField
–
geometry = models.GeometryField(srid=3857, null=True, blank=True)
And Django will automatically handle the conversion. More details on the doc and tutorial.
Where can i get queries sample or comprehensive tutorial for rest framework gis?
You can find all about geodjango on Django documentation. Django rest framework is noting but Django.
- [Django]-Testing django with mongodb (mongoengine) and redis
- [Django]-Why is the first "hello world" example in the django book not working?
- [Django]-Django: login link to appear only when a user is logged in
- [Django]-Cumulative (running) sum of field Django and MySQL
- [Django]-How to use IntegerRangeField in Django template
Source:stackexchange.com