From f85dfb804a218f3a48c90fde44d85e2ca14a228e Mon Sep 17 00:00:00 2001 From: adai Date: Wed, 14 Dec 2022 12:05:27 -0500 Subject: [PATCH] Updated use of shapely.geometry.Polygon and shapely.geometry.collection.GeometryCollection (#1773) --- setup.cfg | 2 +- smarts/core/sumo_road_network.py | 4 ++-- smarts/core/tests/helpers/bubbles.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/setup.cfg b/setup.cfg index fee6d2b167..1f324a24f8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -35,7 +35,7 @@ install_requires = rich>=11.2.0 Rtree>=0.9.7 sh>=1.14.2 - shapely>=1.8.1 + shapely>=2.0.0 tableprint>=0.9.1 trimesh==3.9.29 # Used for writing .glb files visdom>=0.1.8.9 diff --git a/smarts/core/sumo_road_network.py b/smarts/core/sumo_road_network.py index b663226731..2020c265e6 100644 --- a/smarts/core/sumo_road_network.py +++ b/smarts/core/sumo_road_network.py @@ -1209,7 +1209,7 @@ def _snap_internal_holes(self, lane_to_poly, snap_threshold=2): snapped_to.add(nl) thresh *= 0.75 if p != last_added: - new_coords.append(p) + new_coords.append((p.x, p.y)) last_added = p if new_coords: lane_to_poly[lane_id] = (Polygon(new_coords), metadata) @@ -1265,7 +1265,7 @@ def _snap_external_holes(self, lane_to_poly, snap_threshold=2): snapped_to.add(nl) thresh *= 0.75 if p != last_added: - new_coords.append(p) + new_coords.append((p.x, p.y)) last_added = p if new_coords: lane_to_poly[lane_id] = (Polygon(new_coords), metadata) diff --git a/smarts/core/tests/helpers/bubbles.py b/smarts/core/tests/helpers/bubbles.py index 028650924e..125abaa528 100644 --- a/smarts/core/tests/helpers/bubbles.py +++ b/smarts/core/tests/helpers/bubbles.py @@ -19,7 +19,7 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -from collections import defaultdict, namedtuple +from collections import namedtuple from shapely.geometry import LineString from shapely.ops import split @@ -36,7 +36,7 @@ def bubble_geometry(bubble, road_map): airlock_geometry = bubble_geometry_.buffer(bubble.margin) split_x, split_y = airlock_geometry.centroid.coords[0] divider = LineString([(split_x, -999), (split_x, split_y + 999)]) - airlock_entry_geometry, airlock_exit_geometry = split(airlock_geometry, divider) + airlock_entry_geometry, airlock_exit_geometry = (split(airlock_geometry, divider)).geoms return BubbleGeometry( bubble=bubble_geometry_, airlock_entry=airlock_entry_geometry,