Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated use of shapely.geometry.Polygon and shapely.geometry.collection.GeometryCollection #1773

Merged
merged 4 commits into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions smarts/core/sumo_road_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions smarts/core/tests/helpers/bubbles.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down