def write_layer_sf(self, layer_group): output_path = 'data/temp/' data = DataOperator(self.token_key) directory = data.get_layer(layer_group[0]).descriptor output_path += directory geom_type_groups = itertools.groupby(sorted(list(layer_group[1]), key=lambda abc: abc.geom.geom_typeid), lambda y: y.geom.geom_typeid) for geom_type_group in geom_type_groups: self.write_geom_type_sf(output_path, geom_type_group)
def write_layer_sf(self, layer_group): output_path = 'data/temp/' data = DataOperator(self.token_key) directory = data.get_layer(layer_group[0]).descriptor output_path += directory geom_type_groups = itertools.groupby( sorted(list(layer_group[1]), key=lambda abc: abc.geom.geom_typeid), lambda y: y.geom.geom_typeid) for geom_type_group in geom_type_groups: self.write_geom_type_sf(output_path, geom_type_group)
def export_layer(self, layer_uid, format=None, start=None, end=None): data = DataOperator(self.token_key) if not data.has_layer_permissions(layer_uid, Role.VIEWER): return False layer = DataLayer.objects.get(uid=layer_uid) all_features = layer.feature_set.all() features = all_features if start or end: if end: features = features.filter(create_timestamp__lte=end) if start: features = features.filter(create_timestamp__gte=start) self.export_shapefile(features) return True