Opened 14 years ago

Closed 21 months ago

#179 closed enhancement (fixed)

Add Python RTree to OSGEO4W

Reported by: davidfawcett Owned by: osgeo4w-dev@…
Priority: minor Component: Package
Version: Keywords: Rtree
Cc: hobu

Description

In working with Shapely and some of the other Python modules available through OSGEO4W, it would be very useful to have Rtree.

I also think that this would greatly facilitate the use of Rtree in teaching workshops based on OSGEO4W on Windows machines.

Rtree can be found here: http://trac.gispython.org/lab/wiki/Rtree

Rtree depends on the spatial index package: http://trac.gispython.org/spatialindex/wiki

Thank you.

Change History (11)

comment:1 by hobu, 14 years ago

David,

I think it would be more productive to make the Rtree distribution on PyPI easy_install'able instead of putting a copy on osgeo4w that very likely is going to get out of date. What would you think of that?

Alternatively, I could put a windows Rtree egg on PyPI that users could download to their home directories and then point at with PYTHONPATH. I know neither of these solutions is overly convienent for someone trying to have consistent software to teach a lab, but I'm concerned that after a single release, I'll totally forget to update osgeo4w again. If we modify the distribution stuff to push what's needed to PyPI it will always be up-to-date.

Howard

comment:2 by davidfawcett, 14 years ago

Howard,

Thanks for the fast reply. I understand your concern about keeping the version current in OSGEO4W.

My goal is to have a relatively simple way to install Shapely and Rtree in a way that they can be used with the gdal module.

It has been a few months since I attempted this, but as I remember it, the problem with the Windows installer for Rtree was that it doesn't give you an option for which Python install to use. In the case of my work machine, there is the primary Python 2.5 install and the Python that is part of OSGEO4W. The Rtree installer put rtree into the primary Python install, which made it difficult to use gdal from the OSGEO4W install to read in WKB features from an external data source.

It sounds like easy_install could be a way to get around the issues with the installer.

I am OK with not including Rtree in OSGEO4W if I can document a way to use Rtree and Shapely with the Python modules in OSGEO4W. I would be happy to write up the recipe on a wiki some place if I can get it to work.

David

comment:3 by maphew, 12 years ago

Cc: hobu added

I've created a page for installing Python Packages, with an example for using pip (touted as replacement for easy_install). When I tested on Rtree the install failed because spatialindex_c.dll could not be found. Running 'pip install libspatialindex' fails with "No distributions at all found for libspatialindex".

So it seems like we're halfway there.

comment:5 by hobu, 12 years ago

spatialindex_c.dll is in the package. I can't make this a simple .egg package because *nix seems to pick up the egg in preference to the source. If you manually install using the .exe, do you get an Rtree install to work?

` [hobu@fire Downloads]$ unzip Rtree-0.7.0.win32.exe Archive: Rtree-0.7.0.win32.exe warning [Rtree-0.7.0.win32.exe]: 198113 extra bytes at beginning or within zipfile

(attempting to process anyway) inflating: DATA/DLLs/spatialindex.dll inflating: DATA/DLLs/spatialindex_c.dll inflating: PURELIB/rtree/core.py inflating: PURELIB/rtree/index.py inflating: PURELIB/rtree/init.py inflating: PURELIB/Rtree-0.7.0-py2.7.egg-info/dependency_links.txt inflating: PURELIB/Rtree-0.7.0-py2.7.egg-info/not-zip-safe inflating: PURELIB/Rtree-0.7.0-py2.7.egg-info/PKG-INFO inflating: PURELIB/Rtree-0.7.0-py2.7.egg-info/requires.txt inflating: PURELIB/Rtree-0.7.0-py2.7.egg-info/SOURCES.txt inflating: PURELIB/Rtree-0.7.0-py2.7.egg-info/top_level.txt

`

comment:6 by maphew, 12 years ago

Yes installing with the .exe works, provided I've registered the o4w python with Windows as per #114.

Note: the rtree gispython.org link in the description redirects to github, and is then not found. I didn't fix the link as I'm not sure what the true home page is.

comment:8 by mlt, 10 years ago

I recently had to install rtree into OSGeo4W64 myself. Note that one can install "properly" built python package EXEs with %OSGEO4W_ROOT%\apps\Python27\Scripts\easy_install.exe without registering OSGeo4W python. Also, if using OSGeo4W64, replace

    rt = _load_library('spatialindex_c.dll', ctypes.cdll.LoadLibrary)

with

    rt = _load_library('spatialindex_c-64.dll', ctypes.cdll.LoadLibrary)

around line 95 in core.py from rtree so OSGeo4W64 version of SpatialLib is used instead of a bundled one that fails to load probably due to incorrect mvc[rp]90.dll on the PATH.

comment:9 by chau, 4 years ago

I have on several occasions wondered why the RTree python package wasn't included in OSGeo4W. So far I have used the RTree package provided by Christoph Gohlke but it bundles its own libspatialindex binaries which conflicts with the libspatialindex provided with OSGeo4W.

Is the opinion still the same regarding not including the RTree python package into OSGeo4W or does it make more sense to include it now 8 years after this ticket was created?

I saw Howard Butler tweet about the newly released version 0.9.0 and thought this was a good time to revisit the ticket.

comment:10 by tdanckaert, 21 months ago

Rtree has been available in OSGeo4W for some time now, so I believe this ticket can be closed.

comment:11 by jef, 21 months ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.