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

Add ArcGIS API for Python Geometry Support to Weight Objects #331

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 2 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
11 changes: 10 additions & 1 deletion libpysal/weights/_contW_lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,23 @@ def _get_boundary_points(shape):
Recursively handle polygons vs. multipolygons to
extract the boundary point set from each.
"""
if shape.type.lower() == 'polygon':
if shape.type.lower() == "polygon" and \
isinstance(shape, dict) and \
'rings' in shape:
jGaboardi marked this conversation as resolved.
Show resolved Hide resolved
return _get_boundary_points(shape.boundary()) # returns a polyline (path)
elif shape.type.lower() == 'polygon':
shape = shape.boundary
return _get_boundary_points(shape)

elif shape.type.lower() == 'linestring':
return list(map(tuple, list(zip(*shape.coords.xy))))
elif shape.type.lower() == 'multilinestring':
return list(it.chain(*(list(zip(*shape.coords.xy))
for shape in shape)))
elif shape.type.lower() == 'polyline':
coords = []
r = [coords.extend([tuple(p) for p in path]) for path in shape['paths']]
jGaboardi marked this conversation as resolved.
Show resolved Hide resolved
return coords
elif shape.type.lower() == 'multipolygon':
return list(it.chain(*(_get_boundary_points(part.boundary)
for part in shape)))
Expand Down