add original_geometry to building in editor geometry api
This commit is contained in:
parent
3188c4d667
commit
c6a5ed399b
2 changed files with 7 additions and 1 deletions
|
@ -38,6 +38,8 @@ class EditorViewSet(ViewSet):
|
|||
spaces_geom = cascaded_union([space.geometry for space in spaces.values() if space.level == 'normal'])
|
||||
holes_geom = holes_geom.intersection(spaces_geom)
|
||||
doors = section.doors.all()
|
||||
for building in buildings:
|
||||
building.original_geometry = building.geometry
|
||||
for obj in chain(buildings, (s for s in spaces.values() if s.level == 'normal')):
|
||||
obj.geometry = obj.geometry.difference(holes_geom)
|
||||
|
||||
|
|
|
@ -27,11 +27,15 @@ class GeometryMixin(EditorFormMixin):
|
|||
return result
|
||||
|
||||
def to_geojson(self) -> dict:
|
||||
return OrderedDict((
|
||||
result = OrderedDict((
|
||||
('type', 'Feature'),
|
||||
('properties', self.get_geojson_properties()),
|
||||
('geometry', format_geojson(mapping(self.geometry), round=False)),
|
||||
))
|
||||
original_geometry = getattr(self, 'original_geometry', None)
|
||||
if original_geometry:
|
||||
result['original_geometry'] = format_geojson(mapping(original_geometry), round=False)
|
||||
return result
|
||||
|
||||
@classmethod
|
||||
def serialize_type(cls, geomtype=True, **kwargs):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue