I have a model with a field called 'geom' that is a MultiPolygonField. When I query for instances of the model, I'd like the data in this field to follow the right hand rule. Because I am using PostGIS on the back end, I have support for ForceRHR (I am using Django 2.06), but I can't figure out how to use it.
In views.py, I get a URL request with name value pairs, and I convert that dictionary into a dictionary suitable for use in a filter: def field_datasets(request): client_name = 'MSFF' grower = Growers.objects.filter(name__exact=client_name).get() fields = serialize('geojson', Fields.objects.filter(grower__exact=grower.id).filter( Q(*[(k,v)for k,vs in request.GET.lists() for v in vs], _connector=Q.OR) )) return HttpResponse(fields, content_type='json' I've tried this: ... test = Fields.objects.filter(grower__exact=grower.id).filter( Q(*[(k,v)for k,vs in request.GET.lists() for v in vs], _connector=Q.OR) ) test.update(geom = ForceRHR('geom')) fields = serialize('geojson', test) ... and I've tried this: ... test = Fields.objects.filter(grower__exact=grower.id).filter( Q(*[(k,v)for k,vs in request.GET.lists() for v in vs], _connector=Q.OR) ) for item in test: rhr_geom = ForceRHR(item.geom) test[item].geom = rhr_geom fields = serialize('geojson', test) ... The documentation says: Accepts a single geographic field or expression and returns a modified version of the polygon/multipolygon in which all exterior rings are oriented clockwise and all interior rings are oriented counterclockwise. Non-polygonal geometries are returned unchanged. So how else do you pass a geographic field? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/38ae5491-9774-445c-a7bf-83d71d10c79c%40googlegroups.com.