I am relatively new to Python so I am hoping the answer is pretty straightforward, but I can't figure out how to simplify the geometry before adjusting the precision.
I have:
lines = GeometrySerializerMethodField()
lines2 = GeometryField(2, True, source='lines')
def get_lines(self, obj):
# return obj.lines
tolerance = float(self.context['request'].query_params.get('simplify_tolerance', 0.1))
preserve_topology = self.context['request'].query_params.get('simplify_preserve_topology', 'false').lower() == 'true'
return obj.lines.simplify(tolerance, preserve_topology) if obj.lines is not None else None
Lines returns simplified geometry but with all decimal places. Lines2 returns all geometry with 2 decimal places. How would I combine these 2 so I can have simplified geometry with fewer decimal places?
Thanks,
Taylor Johnson