You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I'm no python specialist, just a regular user.
I derived a class from Feature but then, turfpy operations on those derived classes no longer work...
fromgeojsonimportPoint, Featurefromturfpy.measurementimportdistanceclassVertex(Feature):
def__init__(self, node: str, point: Point):
Feature.__init__(self, geometry=point)
self.nodeid=nodep1=Point((25.25458, 51.623879))
f1=Feature(geometry=p1)
v1=Vertex("v1", point=p1)
p2=Point((25.254626, 51.624053))
f2=Feature(geometry=p2)
v2=Vertex("v2", point=p2)
df=distance(f1, f2)
print("df: ",df) # df: 0.019606799666682842print("v1 is feature?", isinstance(v1, Feature)) # truedv=distance(v1, v2)
print("dv: ", dv)
# Error:# Traceback (most recent call last):# File "ft.py", line 19, in <module># dv = distance(v1, v2)# File "/usr/local/miniconda3/lib/python3.9/site-packages/turfpy/measurement.py", line 112, in distance# coordinates1 = get_coord(point1)# File "/usr/local/miniconda3/lib/python3.9/site-packages/turfpy/helper.py", line 80, in get_coord# raise Exception("coord must be GeoJSON Point or an Array of numbers")# Exception: coord must be GeoJSON Point or an Array of numbers
I'd rather derive my Vertex class from Feature rather than "compose" by adding a feature attribute to my Vertex class.
Thanks in advance for your help.
P.
The text was updated successfully, but these errors were encountered:
Hello,
I'm no python specialist, just a regular user.
I derived a class from Feature but then, turfpy operations on those derived classes no longer work...
I'd rather derive my Vertex class from Feature rather than "compose" by adding a feature attribute to my Vertex class.
Thanks in advance for your help.
P.
The text was updated successfully, but these errors were encountered: