i am newbie to django and developing rest api using Django rest framework gis. Previously i was using sql query for transform geometry
select id,name,round(value::numeric,2) as value, st_transform(geometry, 3857) as geometry from my_model
class MyModel(models.Model):
name = models.CharField(max_length=50, blank=True)
value = models.FloatField()
geometry = models.GeometryField(null=True, blank=True)
class Meta:
db_table = u'my_model'
def __unicode__(self):
return '%s' % self.name
Here selrializer class
class MyModelSerializer(serializers.GeoModelSerializer):
class Meta:
model = MyModel
fields = ('id', 'name', 'value', 'geometry')
I have also tried to do this way but cannot transform output
class MyModelViewSet(viewsets.ModelViewSet):
queryset = MyModel.objects.all().transform(3857)
serializer_class = MyModelSerializer
How can i do this in django rest framework gis?
Where can i get queries sample or comprehensive tutorial for rest framework gis?