spaghetti: TypeError: '>' not supported between instances of '_NodeCursor' and '_NodeCursor'
Hi! @jGaboardi!!
I’m trying to snap points to lines using the function net.snapobservations(shp, 'obs') with the git version of spaghetti but I have this error. Can you help me please?
Thank you!
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-14-964ead266930> in <module>
----> 1 net.snapobservations(shp, 'obs', attribute=False)
~/.pyenv/versions/3.6.4/envs/points/lib/python3.6/site-packages/spaghetti/network.py in snapobservations(self, in_data, name, idvariable, attribute)
773 idvariable=idvariable,
774 attribute=attribute)
--> 775 self._snap_to_link(self.pointpatterns[name])
776
777
~/.pyenv/versions/3.6.4/envs/points/lib/python3.6/site-packages/spaghetti/network.py in _snap_to_link(self, pointpattern)
882 points[point_idx] = point['coordinates']
883
--> 884 snapped = util.snap_points_to_links(points, arcs_)
885
886 # record obs_to_arc, dist_to_vertex, and dist_snapped
~/.pyenv/versions/3.6.4/envs/points/lib/python3.6/site-packages/spaghetti/util.py in snap_points_to_links(points, links)
393
394 r = cg.Rect(x0, y0, x1, y1)
--> 395 rt.insert(link, r)
396
397 # Build a KDtree on link vertices.
~/.pyenv/versions/3.6.4/envs/points/lib/python3.6/site-packages/libpysal/cg/rtree.py in insert(self, o, orect)
198
199 def insert(self, o, orect):
--> 200 self.cursor.insert(o, orect)
201 assert(self.cursor.index == 0)
202
~/.pyenv/versions/3.6.4/envs/points/lib/python3.6/site-packages/libpysal/cg/rtree.py in insert(self, leafo, leafrect)
415 self.root, leafo, leafrect))
416
--> 417 self._balance()
418
419 # done: become the original again
~/.pyenv/versions/3.6.4/envs/points/lib/python3.6/site-packages/libpysal/cg/rtree.py in _balance(self)
460 self.root, k, s_children) for k in range(2, MAX_KMEANS)]
461 score, bestcluster = max(
--> 462 [(silhouette_coeff(c, memo), c) for c in clusterings])
463
464 nodes = [_NodeCursor.create_with_children(
TypeError: '>' not supported between instances of '_NodeCursor' and '_NodeCursor'
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 17 (10 by maintainers)
The real thanks is for @ljwolf!
omg @jGaboardi congrats!!! I’ll try it 😃
Potential for solution in #259
I’ll let you know when we have a solution.
@jGaboardi thank you for your efforts! I was able to fix the problem with another library hope you can have a look on it to have an idea of what’s going on.
https://github.com/brendan-ward/nhdnet/blob/master/nhdnet/geometry/lines.py
usage example
https://github.com/brendan-ward/nhdnet/blob/master/custom/sarp/snap_dams.py
Best, Roberto