Skip to content

Commit

Permalink
Updated use of shapely.geometry.Polygon and shapely.geometry.collecti…
Browse files Browse the repository at this point in the history
…on.GeometryCollection (#1773)
  • Loading branch information
Adaickalavan authored Dec 14, 2022
1 parent 3e1ec42 commit f85dfb8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
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

0 comments on commit f85dfb8

Please sign in to comment.