Skip to content

Commit

Permalink
Merge pull request #18 from ungarj/release_2022.6.0
Browse files Browse the repository at this point in the history
Release 2022.6.0
  • Loading branch information
ungarj authored Jun 15, 2022
2 parents f489386 + 460f114 commit 07c6264
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion label_centerlines/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from ._src import get_centerline


__version__ = "0.2"
__version__ = "2022.6.0"

logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())
10 changes: 5 additions & 5 deletions label_centerlines/_src.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import numpy as np
import operator
from scipy.spatial import Voronoi
from scipy.ndimage import filters
from scipy.ndimage import gaussian_filter1d
from shapely.geometry import LineString, MultiLineString, Point, MultiPoint

from label_centerlines.exceptions import CenterlineError
Expand Down Expand Up @@ -100,10 +100,10 @@ def get_centerline(
return centerline

elif geom.geom_type == "MultiPolygon":
logger.debug("MultiPolygon found with %s sub-geometries", len(geom))
logger.debug("MultiPolygon found with %s sub-geometries", len(geom.geoms))
# get centerline for each part Polygon and combine into MultiLineString
sub_centerlines = []
for subgeom in geom:
for subgeom in geom.geoms:
try:
sub_centerline = get_centerline(
subgeom, segmentize_maxlen, max_points, simplification, smooth_sigma
Expand Down Expand Up @@ -148,8 +148,8 @@ def _smooth_linestring(linestring, smooth_sigma):
"""Use a gauss filter to smooth out the LineString coordinates."""
return LineString(
zip(
np.array(filters.gaussian_filter1d(linestring.xy[0], smooth_sigma)),
np.array(filters.gaussian_filter1d(linestring.xy[1], smooth_sigma)),
np.array(gaussian_filter1d(linestring.xy[0], smooth_sigma)),
np.array(gaussian_filter1d(linestring.xy[1], smooth_sigma)),
)
)

Expand Down
2 changes: 1 addition & 1 deletion label_centerlines/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,5 +164,5 @@ def _feature_worker(
elif centerline.geom_type == "MultiLineString":
return [
(dict(feature, geometry=mapping(subgeom)), elapsed)
for subgeom in centerline
for subgeom in centerline.geoms
]
2 changes: 1 addition & 1 deletion test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
@pytest.fixture
def alps_shape():
with fiona.open(os.path.join(TESTDATA_DIR, "alps.geojson"), "r") as src:
return shape(next(src)["geometry"])
return shape(next(iter(src))["geometry"])

0 comments on commit 07c6264

Please sign in to comment.