diff --git a/polytope_mars/api.py b/polytope_mars/api.py index be693bf..e07b3ea 100644 --- a/polytope_mars/api.py +++ b/polytope_mars/api.py @@ -27,7 +27,7 @@ "frame": Frame, "path": Path, "shapefile": Shapefile, - "wkt": Wkt, + "polygon": Wkt, } diff --git a/polytope_mars/features/wkt.py b/polytope_mars/features/wkt.py index 2261a87..e53bdc4 100644 --- a/polytope_mars/features/wkt.py +++ b/polytope_mars/features/wkt.py @@ -1,8 +1,9 @@ from polytope import shapes -from shapely import wkt from ..feature import Feature +# from shapely import wkt + # Function to convert POLYGON and MULTIPOLYGON to points def get_coords(geom): @@ -17,20 +18,20 @@ def get_coords(geom): class Wkt(Feature): def __init__(self, config): - assert config.pop("type") == "wkt" + assert config.pop("type") == "polygon" self.shape = config.pop("shape") - self.df = wkt.loads(self.shape) + # self.df = wkt.loads(self.shape) assert len(config) == 0, f"Unexpected keys in config: {config.keys()}" def get_shapes(self): - coordinates = get_coords(self.df) + # coordinates = get_coords(self.df) polygons = [] - for coord in coordinates: - points = [] - for point in coord: - points.append([point[0], point[1]]) - polygons.append(shapes.Polygon(["latitude", "longitude"], points)) + # for coord in self.shape: + points = [] + for point in self.shape: + points.append([point[0], point[1]]) + polygons.append(shapes.Polygon(["latitude", "longitude"], points)) return [shapes.Union(["latitude", "longitude"], *polygons)] def incompatible_keys(self):