Git Product home page Git Product logo

pyrtree's People

Contributors

danshoutis avatar

Watchers

 avatar

pyrtree's Issues

Implicit relative imports do not work in Python 3

I downloaded the most recent release (pyrtree-0a12e64c7386.zip) and then 
installed it for Python 3.3 by running "python3.3 setup.py install". But it 
doesn't work:

    Python 3.3.2 (default, May 21 2013, 11:50:47) 
    [GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import pyrtree
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pyrtree/__init__.py", line 4, in <module>
        import rect
    ImportError: No module named 'rect'

Python 3 no longer supports implicit package-relative imports (see PEP 404 
<http://www.python.org/dev/peps/pep-0404/>). So the import statements need to 
be changed to be package-relative. In __init__.py you should replace:

    import rect
    import rtree

with

    from . import rect
    from . import rtree

and in rtree.py you should replace:

    from rect import Rect, union_all, NullRect

with:

    from .rect import Rect, union_all, NullRect

(Similar changes need to be made in the bench/ and test/ subdirectories.)

Original issue reported on code.google.com by [email protected] on 4 Jan 2014 at 10:48

Assertion error for zero-sized rectangles

What steps will reproduce the problem?
1. Create a zero-sized length

What is the expected output? What do you see instead?

I expect things to work. I get assertion error.

What version of the product are you using? On what operating system?

Python 2.6.6, Windows Vista.

Please provide any additional information below.

rect = Rect(point.coords[0], point.coords[1], point.coords[0], point.coords[1])
print rect.extent(), point.coords
self.extent = rect.union(self.extent)
self.points.append(point)

Traceback (most recent call last):
  File "C:\Users\valit\Desktop\?\?.py", line 89, in <module>
    a = PointCollection('?.csv', '?')
  File "C:\Users\valit\Desktop\?\?.py", line 39, in __init__
    self.rtree.insert(point, rect)
  File "C:\Python26\lib\pyrtree\rtree.py", line 45, in insert
    self.cursor.insert(o,orect)
  File "C:\Python26\lib\pyrtree\rtree.py", line 203, in insert
    self._insert_child(_NodeCursor.create_leaf(self.root,leafo,leafrect))
  File "C:\Python26\lib\pyrtree\rtree.py", line 92, in create_leaf
    assert(res.is_leaf())
AssertionError


This wont give an error:
rect = Rect(point.coords[0], point.coords[1], point.coords[0]+0.0000001, 
point.coords[1]+0.0000001)

Original issue reported on code.google.com by [email protected] on 9 May 2011 at 12:51

Shall I add Rect comparison operators?

In my own client code I found comparison operators for Rect to be useful.  If I 
add them (and you find them acceptable) will you accept them?

The operators make Rect hashable and sortable.  Aside from that, rect1 < rect2 
is not a very interesting geometric comparison.


Original issue reported on code.google.com by [email protected] on 23 Aug 2013 at 12:12

NullRect must be imported to unit tests

What steps will reproduce the problem?
1. Run unit tests

What is the expected output? What do you see instead?

I excpect them to finish with all OK.

I get failure of two tests with NullRect not defined.
Ran 11 tests in 259.657s
FAILED (errors=2)

from pyrtree import Rect, RTree
+ from pyrtree.rect import NullRect
#from pyrtree.rect import *

With "+" I mark added line, which fixes the problem.
Ran 11 tests in 257.825s
OK

What version of the product are you using? On what operating system?

Python 2.6.6 on Windows Vista.

Please provide any additional information below.

======================================================================
ERROR: testCons (__main__.RectangleTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\valit\Desktop\Rtree\pyrtree\tests\test_rtree.py", line 77, in testCons
    self.assertTrue(r is not NullRect)
NameError: global name 'NullRect' is not defined

======================================================================
ERROR: testIntersection (__main__.RectangleTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\valit\Desktop\Rtree\pyrtree\tests\test_rtree.py", line 95, in testIntersection
    self.assertTrue(res2 is NullRect)
NameError: global name 'NullRect' is not defined

----------------------------------------------------------------------
Ran 11 tests in 259.657s

FAILED (errors=2)

Traceback (most recent call last):
  File "C:\Users\valit\Desktop\Rtree\pyrtree\tests\test_rtree.py", line 266, in <module>
    ut.main()
  File "C:\Python26\lib\unittest.py", line 817, in __init__
    self.runTests()
  File "C:\Python26\lib\unittest.py", line 865, in runTests
    sys.exit(not result.wasSuccessful())
SystemExit: True

Original issue reported on code.google.com by [email protected] on 8 May 2011 at 8:50

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.