Transformer.point_as_polygon
- classmethod Transformer.point_as_polygon(multi_poly_coords)[source]
Make the coordinates of a single ‘Point’ (in a ‘MultiPolygon’) be reformatted to a ‘Polygon’-like coordinates.
The list of coordinates of some ‘MultiPolygon’ features may contain single points. In order to reformat such multipart geometry (from dict into shapely.geometry type), there is a need to ensure each of the constituent parts is a shapely.geometry.Polygon.
- Parameters:
multi_poly_coords (list) – original data of coordinates of a shapely.geometry.MultiPolygon feature
- Returns:
coordinates that are reformatted as appropriate
- Return type:
list
Examples:
>>> from pydriosm.reader import Transformer >>> geometry = { ... 'type': 'MultiPolygon', ... 'coordinates': [[[[-0.6920145, 52.6753268], [-0.6920145, 52.6753268]]]] ... } >>> mp_coords = geometry['coordinates'] >>> mp_coords_ = Transformer.point_as_polygon(mp_coords) >>> mp_coords_ [[[[-0.6920145, 52.6753268], [-0.6920145, 52.6753268], [-0.6920145, 52.6753268]]]]