@@ -1820,8 +1820,8 @@ def mask_for_polygons(polygons: MultiPolygon, mask: np.ndarray) -> np.ndarray:
18201820 def int_coords (x ):
18211821 # function to round and convert to int
18221822 return np .array (x ).round ().astype (np .int32 )
1823- exteriors = [int_coords (poly .exterior .coords ) for poly in polygons ]
1824- interiors = [int_coords (pi .coords ) for poly in polygons for pi in poly .interiors ]
1823+ exteriors = [int_coords (poly .exterior .coords ) for poly in polygons . geoms ]
1824+ interiors = [int_coords (pi .coords ) for poly in polygons . geoms for pi in poly .interiors ]
18251825 cv2 .fillPoly (mask , exteriors , 1 )
18261826 cv2 .fillPoly (mask , interiors , 0 )
18271827 return mask
@@ -1885,7 +1885,7 @@ def _polygon_geom_to_mask(self,
18851885 [1.0 , 0.0 , 0.0 , 1.0 , trans_x , trans_y ])
18861886 new_polygon = affinity .scale (new_polygon , xfact = scale_width , yfact = scale_height , origin = (0 , 0 ))
18871887
1888- if new_polygon .geom_type is 'Polygon' :
1888+ if new_polygon .geom_type == 'Polygon' :
18891889 new_polygon = MultiPolygon ([new_polygon ])
18901890 map_mask = self .mask_for_polygons (new_polygon , map_mask )
18911891
@@ -1922,7 +1922,7 @@ def _line_geom_to_mask(self,
19221922
19231923 map_mask = np .zeros (canvas_size , np .uint8 )
19241924
1925- if layer_name is 'traffic_light' :
1925+ if layer_name == 'traffic_light' :
19261926 return None
19271927
19281928 for line in layer_geom :
@@ -1968,7 +1968,7 @@ def _get_layer_polygon(self,
19681968 origin = (patch_x , patch_y ), use_radians = False )
19691969 new_polygon = affinity .affine_transform (new_polygon ,
19701970 [1.0 , 0.0 , 0.0 , 1.0 , - patch_x , - patch_y ])
1971- if new_polygon .geom_type is 'Polygon' :
1971+ if new_polygon .geom_type == 'Polygon' :
19721972 new_polygon = MultiPolygon ([new_polygon ])
19731973 polygon_list .append (new_polygon )
19741974
@@ -1983,7 +1983,7 @@ def _get_layer_polygon(self,
19831983 origin = (patch_x , patch_y ), use_radians = False )
19841984 new_polygon = affinity .affine_transform (new_polygon ,
19851985 [1.0 , 0.0 , 0.0 , 1.0 , - patch_x , - patch_y ])
1986- if new_polygon .geom_type is 'Polygon' :
1986+ if new_polygon .geom_type == 'Polygon' :
19871987 new_polygon = MultiPolygon ([new_polygon ])
19881988 polygon_list .append (new_polygon )
19891989
@@ -2003,7 +2003,7 @@ def _get_layer_line(self,
20032003 if layer_name not in self .map_api .non_geometric_line_layers :
20042004 raise ValueError ("{} is not a line layer" .format (layer_name ))
20052005
2006- if layer_name is 'traffic_light' :
2006+ if layer_name == 'traffic_light' :
20072007 return None
20082008
20092009 patch_x = patch_box [0 ]
0 commit comments