Giter Club home page Giter Club logo

jsi's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jsi's Issues

Find an alternative implementation for comparison tests

The nearestN_10000 test fails, because the SIL library results do not match the expected results (from the SimpleIndex implementation). Note that the JSI results are as expected.

As it is unsupported and ancient, an alternative implementation should be found for comparison tests.

Could you include an example of how to include the library as a <dependency> in the POM file?

I tried to add the following to the pom.xml

<repositories>
  <repository>
    <id>jsi.sourceforge.net</id>
    <name>sourceforge jsi repository</name>
    <url>http://sourceforge.net/projects/jsi/files/m2_repo</url>
  </repository>
</repositories> 

<dependency>
  <groupId>net.sourceforge.jsi</groupId>
  <artifactId>jsi</artifactId>
  <version>1.0.0</version>
</dependency>

and I received the following error: "The POM for net.sourceforge.jsi:jsi:jar:1.0.0 is missing, no dependency information available"

Thanks!

Indexing just Points

Hi,

I've been searching an implementation of RTree's to perform some tests of a prototype, but I've seen that it is not directly allowed to add just points to the RTree. I've made a workaround that seems to work by adding "one-dimensional rectangles" :P, but am I missing anything? Why aren't Points allowed to be added directly (at least in this implementation - I've seen others that allowed me to do so)?

Thank you in advance

Tree corruption when all entries are deleted

Copied from sourceforge help forum:

Just for testing, I make an RTree with at least one element per node, and at most two elements per node. I add three items to it, remove them all, and try to add them again. The program crashes during the last of the aforementioned steps, upon the first attempt to add one of the items. As reported above, the root node is at level 2, and the tree has height 2, when the tree is empty. This seems to be the problem. It seems to be necessary to completely empty the tree in order to put it in the corrupt state. This differs from the above report, wherein it is said that the problem occurs after 100 items were added and 60-80 were removed. I tried adding 3001 and removing 3000 and there was no corruption. But removing the last item causes trouble.

Some strange errors when fetching resources from sourceforge mvn repo

Sourceforge is redirecting and and doing all sorts of silly magic when gradle attempts to download from them... Is there an alternative host for these resources?

Invalid cookie header: "Set-Cookie: webflash=; expires="Sun, 09-Mar-2014 21:20:21 GMT"; Max-Age=0; Path=/". Unable to parse expires attribute: "Sun, 09-Mar-2014 21:20:21 GMT"
Invalid cookie header: "Set-Cookie: webflash=; expires="Sun, 09-Mar-2014 21:20:21 GMT"; Max-Age=0; Path=/". Unable to parse expires attribute: "Sun, 09-Mar-2014 21:20:21 GMT"
Invalid cookie header: "Set-Cookie: webflash=; expires="Sun, 09-Mar-2014 21:20:21 GMT"; Max-Age=0; Path=/". Unable to parse expires attribute: "Sun, 09-Mar-2014 21:20:21 GMT"
Invalid cookie header: "Set-Cookie: webflash=; expires="Sun, 09-Mar-2014 21:20:21 GMT"; Max-Age=0; Path=/". Unable to parse expires attribute: "Sun, 09-Mar-2014 21:20:21 GMT"
Invalid cookie header: "Set-Cookie: VISITOR=532372942d82e34c6a584aec; expires="Mon, 11-Mar-2024 21:20:21 GMT"; httponly; Max-Age=315360000; Path=/". Unable to parse expires attribute: "Mon, 11-Mar-2024 21:20:21 GMT"
Resource missing. [HTTP HEAD: http://sourceforge.net/projects/jsi/files/m2_repo/net/sourceforge/jsi/jsi/1.1.0-SNAPSHOT/jsi-1.1.0-SNAPSHOT.jar]

RTree only supports 2 dimensions

Hi. My name is Randall Scarberry and I work for a company in Albuquerque, NM called Stellar Science. I was investigating the use of R-trees for one of our applications and came across your version. Since our project required a 3-D implementation, however, I modified the code to support an arbitrary number of dimensions greater than or equal to 2.

The 3-D version works well, so I wanted to contribute back our changes in keeping with open source practice. My version deviates a great deal from the original, so a pull request wouldn't be the way to go. For example, we use fastutil for collections of primitives instead of trove. If you contact me, I can send you a zip file containing the modified code.

My email address is [email protected]

Thanks!

NPI when rectangles have MAX_VALUE in coordinates

[copied from sourceforge help forum]

RTree sometimes throws nullpointer exceptions when Rectangles upper bounds (or at least part of them) are unbounded (Float.MAX_VALUE). Here is a test case that demonstrates the problem (it's kind of large but I'm unable to reproduce the bug with a smaller test):

@test public void rTreeTest(){ RTree rTree = new RTree(); rTree.init(new Properties()); rTree.add(new Rectangle(8.0f, 6.0f, Float.MAX_VALUE, Float.MAX_VALUE), 1); rTree.add(new Rectangle(1.0f, 5.0f, Float.MAX_VALUE, Float.MAX_VALUE), 2); rTree.add(new Rectangle(10.0f, 6.0f, Float.MAX_VALUE, Float.MAX_VALUE), 3); rTree.add(new Rectangle(5.0f, 8.0f, Float.MAX_VALUE, Float.MAX_VALUE), 4); rTree.add(new Rectangle(6.0f, 1.0f, Float.MAX_VALUE, Float.MAX_VALUE), 6); rTree.add(new Rectangle(3.0f, 1.0f, Float.MAX_VALUE, Float.MAX_VALUE), 7); rTree.add(new Rectangle(9.0f, 8.0f, Float.MAX_VALUE, Float.MAX_VALUE), 8); rTree.add(new Rectangle(5.0f, 7.0f, Float.MAX_VALUE, Float.MAX_VALUE), 9); rTree.add(new Rectangle(2.0f, 5.0f, Float.MAX_VALUE, Float.MAX_VALUE), 10); rTree.add(new Rectangle(2.0f, 2.0f, Float.MAX_VALUE, Float.MAX_VALUE), 11); rTree.add(new Rectangle(5.0f, 3.0f, Float.MAX_VALUE, Float.MAX_VALUE), 14); rTree.add(new Rectangle(7.0f, 3.0f, Float.MAX_VALUE, Float.MAX_VALUE), 15); rTree.add(new Rectangle(6.0f, 3.0f, Float.MAX_VALUE, Float.MAX_VALUE), 16); rTree.delete(new Rectangle(9.0f, 8.0f, Float.MAX_VALUE, Float.MAX_VALUE), 8); rTree.add(new Rectangle(7.0f, 8.0f, Float.MAX_VALUE, Float.MAX_VALUE), 17); rTree.add(new Rectangle(3.0f, 5.0f, Float.MAX_VALUE, Float.MAX_VALUE), 18); rTree.delete(new Rectangle(5.0f, 7.0f, Float.MAX_VALUE, Float.MAX_VALUE), 9); rTree.add(new Rectangle(4.0f, 7.0f, Float.MAX_VALUE, Float.MAX_VALUE), 19); rTree.delete(new Rectangle(2.0f, 5.0f, Float.MAX_VALUE, Float.MAX_VALUE), 10); rTree.add(new Rectangle(2.0f, 1.0f, Float.MAX_VALUE, Float.MAX_VALUE), 20); rTree.add(new Rectangle(9.0f, 6.0f, Float.MAX_VALUE, Float.MAX_VALUE), 21); rTree.add(new Rectangle(7.0f, 6.0f, Float.MAX_VALUE, Float.MAX_VALUE), 22); rTree.delete(new Rectangle(10.0f, 6.0f, Float.MAX_VALUE, Float.MAX_VALUE), 3); rTree.add(new Rectangle(3.0f, 4.0f, Float.MAX_VALUE, Float.MAX_VALUE), 23); rTree.delete(new Rectangle(3.0f, 1.0f, Float.MAX_VALUE, Float.MAX_VALUE), 7); rTree.add(new Rectangle(3.0f, 1.0f, Float.MAX_VALUE, Float.MAX_VALUE), 24); rTree.delete(new Rectangle(8.0f, 6.0f, Float.MAX_VALUE, Float.MAX_VALUE), 1); rTree.add(new Rectangle(3.0f, 6.0f, Float.MAX_VALUE, Float.MAX_VALUE), 25); rTree.delete(new Rectangle(7.0f, 8.0f, Float.MAX_VALUE, Float.MAX_VALUE), 17); rTree.add(new Rectangle(7.0f, 8.0f, Float.MAX_VALUE, Float.MAX_VALUE), 26); rTree.delete(new Rectangle(2.0f, 1.0f, Float.MAX_VALUE, Float.MAX_VALUE), 20); rTree.add(new Rectangle(0.0f, 1.0f, Float.MAX_VALUE, Float.MAX_VALUE), 27); rTree.delete(new Rectangle(2.0f, 2.0f, Float.MAX_VALUE, Float.MAX_VALUE), 11); rTree.add(new Rectangle(2.0f, 2.0f, Float.MAX_VALUE, Float.MAX_VALUE), 28); rTree.delete(new Rectangle(5.0f, 8.0f, Float.MAX_VALUE, Float.MAX_VALUE), 4); rTree.add(new Rectangle(4.0f, 2.0f, Float.MAX_VALUE, Float.MAX_VALUE), 29); rTree.delete(new Rectangle(5.0f, 3.0f, Float.MAX_VALUE, Float.MAX_VALUE), 14); rTree.add(new Rectangle(5.0f, 3.0f, Float.MAX_VALUE, Float.MAX_VALUE), 30); rTree.add(new Rectangle(7.0f, 5.0f, Float.MAX_VALUE, Float.MAX_VALUE), 31); rTree.delete(new Rectangle(7.0f, 5.0f, Float.MAX_VALUE, Float.MAX_VALUE), 31); rTree.add(new Rectangle(7.0f, 5.0f, Float.MAX_VALUE, Float.MAX_VALUE), 32); rTree.add(new Rectangle(5.0f, 8.0f, Float.MAX_VALUE, Float.MAX_VALUE), 33); rTree.delete(new Rectangle(2.0f, 2.0f, Float.MAX_VALUE, Float.MAX_VALUE), 28); rTree.add(new Rectangle(1.0f, 2.0f, Float.MAX_VALUE, Float.MAX_VALUE), 34); rTree.delete(new Rectangle(0.0f, 1.0f, Float.MAX_VALUE, Float.MAX_VALUE), 27); rTree.add(new Rectangle(0.0f, 1.0f, Float.MAX_VALUE, Float.MAX_VALUE), 35); rTree.add(new Rectangle(8.0f, 5.0f, Float.MAX_VALUE, Float.MAX_VALUE), 36); rTree.delete(new Rectangle(3.0f, 5.0f, Float.MAX_VALUE, Float.MAX_VALUE), 18); rTree.add(new Rectangle(3.0f, 5.0f, Float.MAX_VALUE, Float.MAX_VALUE), 37); rTree.add(new Rectangle(8.0f, 7.0f, Float.MAX_VALUE, Float.MAX_VALUE), 39); rTree.delete(new Rectangle(7.0f, 6.0f, Float.MAX_VALUE, Float.MAX_VALUE), 22); rTree.add(new Rectangle(5.0f, 2.0f, Float.MAX_VALUE, Float.MAX_VALUE), 40); rTree.delete(new Rectangle(3.0f, 1.0f, Float.MAX_VALUE, Float.MAX_VALUE), 24); rTree.add(new Rectangle(3.0f, 0.0f, Float.MAX_VALUE, Float.MAX_VALUE), 41); rTree.delete(new Rectangle(7.0f, 8.0f, Float.MAX_VALUE, Float.MAX_VALUE), 26); rTree.add(new Rectangle(7.0f, 5.0f, Float.MAX_VALUE, Float.MAX_VALUE), 42); rTree.delete(new Rectangle(7.0f, 3.0f, Float.MAX_VALUE, Float.MAX_VALUE), 15); rTree.add(new Rectangle(3.0f, 2.0f, Float.MAX_VALUE, Float.MAX_VALUE), 43); rTree.delete(new Rectangle(4.0f, 2.0f, Float.MAX_VALUE, Float.MAX_VALUE), 29); rTree.add(new Rectangle(4.0f, 2.0f, Float.MAX_VALUE, Float.MAX_VALUE), 44); rTree.delete(new Rectangle(3.0f, 6.0f, Float.MAX_VALUE, Float.MAX_VALUE), 25); rTree.add(new Rectangle(3.0f, 5.0f, Float.MAX_VALUE, Float.MAX_VALUE), 45); rTree.delete(new Rectangle(3.0f, 2.0f, Float.MAX_VALUE, Float.MAX_VALUE), 43); rTree.add(new Rectangle(1.0f, 0.0f, Float.MAX_VALUE, Float.MAX_VALUE), 46); rTree.delete(new Rectangle(1.0f, 5.0f, Float.MAX_VALUE, Float.MAX_VALUE), 2); rTree.add(new Rectangle(1.0f, 5.0f, Float.MAX_VALUE, Float.MAX_VALUE), 47); rTree.delete(new Rectangle(9.0f, 6.0f, Float.MAX_VALUE, Float.MAX_VALUE), 21); rTree.add(new Rectangle(7.0f, 6.0f, Float.MAX_VALUE, Float.MAX_VALUE), 48); rTree.delete(new Rectangle(4.0f, 7.0f, Float.MAX_VALUE, Float.MAX_VALUE), 19); rTree.add(new Rectangle(4.0f, 0.0f, Float.MAX_VALUE, Float.MAX_VALUE), 49); rTree.delete(new Rectangle(5.0f, 3.0f, Float.MAX_VALUE, Float.MAX_VALUE), 30); rTree.add(new Rectangle(0.0f, 2.0f, Float.MAX_VALUE, Float.MAX_VALUE), 50); rTree.delete(new Rectangle(5.0f, 8.0f, Float.MAX_VALUE, Float.MAX_VALUE), 33); rTree.add(new Rectangle(4.0f, 8.0f, Float.MAX_VALUE, Float.MAX_VALUE), 51); rTree.delete(new Rectangle(3.0f, 5.0f, Float.MAX_VALUE, Float.MAX_VALUE), 45); rTree.add(new Rectangle(3.0f, 5.0f, Float.MAX_VALUE, Float.MAX_VALUE), 52); rTree.delete(new Rectangle(7.0f, 5.0f, Float.MAX_VALUE, Float.MAX_VALUE), 42); rTree.add(new Rectangle(7.0f, 5.0f, Float.MAX_VALUE, Float.MAX_VALUE), 53); rTree.delete(new Rectangle(5.0f, 2.0f, Float.MAX_VALUE, Float.MAX_VALUE), 40); rTree.add(new Rectangle(3.0f, 2.0f, Float.MAX_VALUE, Float.MAX_VALUE), 54); rTree.delete(new Rectangle(6.0f, 1.0f, Float.MAX_VALUE, Float.MAX_VALUE), 6); rTree.add(new Rectangle(6.0f, 1.0f, Float.MAX_VALUE, Float.MAX_VALUE), 55); rTree.delete(new Rectangle(4.0f, 8.0f, Float.MAX_VALUE, Float.MAX_VALUE), 51); rTree.add(new Rectangle(4.0f, 8.0f, Float.MAX_VALUE, Float.MAX_VALUE), 56); rTree.delete(new Rectangle(1.0f, 5.0f, Float.MAX_VALUE, Float.MAX_VALUE), 47); rTree.add(new Rectangle(1.0f, 5.0f, Float.MAX_VALUE, Float.MAX_VALUE), 57); rTree.delete(new Rectangle(0.0f, 2.0f, Float.MAX_VALUE, Float.MAX_VALUE), 50); rTree.add(new Rectangle(0.0f, 2.0f, Float.MAX_VALUE, Float.MAX_VALUE), 58); rTree.delete(new Rectangle(3.0f, 0.0f, Float.MAX_VALUE, Float.MAX_VALUE), 41); rTree.add(new Rectangle(3.0f, 0.0f, Float.MAX_VALUE, Float.MAX_VALUE), 59); rTree.delete(new Rectangle(7.0f, 5.0f, Float.MAX_VALUE, Float.MAX_VALUE), 53); rTree.add(new Rectangle(0.0f, 5.0f, Float.MAX_VALUE, Float.MAX_VALUE), 60); rTree.delete(new Rectangle(6.0f, 1.0f, Float.MAX_VALUE, Float.MAX_VALUE), 55); rTree.add(new Rectangle(2.0f, 1.0f, Float.MAX_VALUE, Float.MAX_VALUE), 61); rTree.delete(new Rectangle(7.0f, 5.0f, Float.MAX_VALUE, Float.MAX_VALUE), 32); rTree.add(new Rectangle(0.0f, 5.0f, Float.MAX_VALUE, Float.MAX_VALUE), 62); rTree.delete(new Rectangle(0.0f, 2.0f, Float.MAX_VALUE, Float.MAX_VALUE), 58); rTree.add(new Rectangle(0.0f, 2.0f, Float.MAX_VALUE, Float.MAX_VALUE), 63); rTree.delete(new Rectangle(3.0f, 4.0f, Float.MAX_VALUE, Float.MAX_VALUE), 23); rTree.add(new Rectangle(3.0f, 3.0f, Float.MAX_VALUE, Float.MAX_VALUE), 64); rTree.delete(new Rectangle(8.0f, 7.0f, Float.MAX_VALUE, Float.MAX_VALUE), 39); }

Error using RTree

Hi,

I have an issue when I use an object of type RTree, I store my SpatialIndex in a redis cache like a string (format JSON), I recovery this and cast from json to RTree class, I initialize it with the init method and when I try to add a new rectangle to the index by twice I receive a nullpointer in the choosenode method, exactly in this part:

Node n = getNode(rootNodeId); (RTree.class -> chooseNode)

I lose values of nodeMap and rootNodeId, I can see debugging it.

I think this problem is because in redis I store it like a string and then I convert this one to RTree class but it's the only way I have to do that.

There is a different way to use this type of objects?

Thanks!

Does JSI support bulk load data?

In some cases, the dataset is immutable, so bulk loading data is a better choice, like STR (sort-tile-recursive). Does JSI support bulk load data?

It seems not.

Hope for a newer version providing such feature.

About Rtree Creation

Hello Sir/Mam,
I am working on RTree. I need it to find Skyline points. Please go through the following link :

http://infolab.usc.edu/csci587/Fall2010/papers/An%20optimal%20and%20progressive%20algorithm%20for%20skyline%20queries.pdf

Go to page number 471 in the above link.
I am writing following test code to check whether rtree is correctly working ,

package com.infomatiq.jsi;
import com.infomatiq.jsi.rtree.Node;
import com.infomatiq.jsi.rtree.RTree;
import gnu.trove.TIntProcedure;
import java.util.Properties;
public class Test {
public static void main(String[] args) {
RTree sp = new RTree();
Properties p = new Properties();
sp.setMaxNodeEntries(3);
sp.init(p);
sp.add(new Rectangle(1,9,0,0),1);
sp.add(new Rectangle(2,10,0,0),2);
sp.add(new Rectangle(4,8,0,0),3);
sp.add(new Rectangle(6,7,0,0),4);
sp.add(new Rectangle(9,10,0,0),5);
sp.add(new Rectangle(7,5,0,0),6);
sp.add(new Rectangle(5,6,0,0),7);
sp.add(new Rectangle(4,3,0,0),8);
sp.add(new Rectangle(3,2,0,0),9);
sp.add(new Rectangle(10,4,0,0),10);
sp.add(new Rectangle(9,1,0,0),11);
sp.add(new Rectangle(6,2,0,0),12);
sp.add(new Rectangle(8,3,0,0),13);
printTree(sp);
}

private static void printTree(RTree sp) {
    printTree(sp, sp.getRootNodeId(), 0);
  }

private static void printTree(RTree sp, int id, int level) {
   Node n = sp.getNode(id);
    if (n == null) {
        return;
    }
    System.out.print("node [" + id + "] ");
    n.print();
    System.out.println("level " + n.getLevel() + " leaf " + n.getEntryCount());
    for (int i = 0; i < n.getEntryCount(); i++) {
        int idx = n.getId(i);
        if (!n.isLeaf()) {
            printTree(sp, idx, level + 1);
        } else {
            System.out.print("Leaf value------------------>     entry [" + idx + "] ");
            n.print(i);
        }
    }
}

}

---------------------------Print Method is InNode class ----------------------------
public void print(int entry)
{
System.out.println("" + entriesMinX[entry] + "," + entriesMinY[entry] + " " + entriesMaxX[entry] + "," +
entriesMaxY[entry])
}

--------------------------------------------------In Node class------------------------------------------------
public void print()
{
System.out.println(mbrMinX + "," + mbrMinY + " " + mbrMaxX + "," + mbrMaxY);

}

-----And Rectangle has to draw automatically by rtree code ------------------------
It dimension are below as per link pdf ::
sp.add(new Rectangle(1,5,9,10),1);
sp.add(new Rectangle(3,1,10,6),1);
sp.add(new Rectangle(1,8,4,10),2);
sp.add(new Rectangle(6,5,9,10),2);
sp.add(new Rectangle(3,2,5,6),2);
sp.add(new Rectangle(9,1,10,4),2);
sp.add(new Rectangle(6,2,8,3),2);

Now it is not giving correct output. As per the Pdf [In above link]. And also it is not giving a tree in correctly. Please guide me where I am wrong?.
Please contact me on [email protected]

switch to slf4j?

Hi,

I would like to use your library on Android and I have problems with the log4j dependency. Do you foresee the possibility of switching to slf4j instead?
I could provide a patch to do that.

thanks,
nicolae

Is there an attribute or method to write complete hierarchy?

Hi,

Thank you for the implementation.

I am trying to use R Tree implementation here and I have to write the hierarchy created on file so that I can further visualize containment relationship of spatial points. Is there an attribute or method that returns object which I can write to file.

Please suggest.

Thanks

Calling nearestN() results in OutOfMemoryError. Possible tree corruption?

Calling nearestN() (and nearestNUnsorted()) for my large dataset (~116,000 entries) results in an OutOfMemoryError when furthestDistance is greater than a certain value. The error seems to be caused by the repeated addition of nodes of the same priority to savedValues in line 397 of RTree.java.

Printing the results of these methods called with furthestDistance slightly lower than the error-causing value results in the repetition of a certain leaf; in other words it seems as though some points in leafs, appear more than once in said leaf.

The data file can be found here: http://dl.dropbox.com/u/25744857/cities_by_location.txt

I created a small method below that illustrates the problem. Leave furthestDistanceMultiplier at 1 to to observe the repetition of a given point, and increase it to 2 or higher to cause the error.

public static void initializeLocationRtree(String fileName)
    {
        RTree locationDataRTree = new RTree();
        locationDataRTree.init(null);

        try
        {
            File locationDataFile = new File(fileName);
            Scanner locationDataFileScanner = new Scanner(locationDataFile);

            while(locationDataFileScanner.hasNextLine())
            {
                String currentLine = locationDataFileScanner.nextLine();
                String[] currentLocationDataArray = currentLine.split("\\t");
                Float currentLocationLongitude = Float.parseFloat(currentLocationDataArray[0]);
                Float currentLocationLatitude = Float.parseFloat(currentLocationDataArray[1]);

                Float currentLocationGMTOffsetFloat = Float.parseFloat(currentLocationDataArray[3]);

                int rectangleID =  (int)Math.round(Math.random() * Integer.MAX_VALUE); 

                Rectangle leafRectangle = new Rectangle();
                leafRectangle.add(new Point(currentLocationLongitude, currentLocationLatitude));
                locationDataRTree.add(leafRectangle, rectangleID);
            }

            System.out.println("The size of the RTree is " + locationDataRTree.size());

            float desiredLongitude = (float)-85.47;
            float desiredLatitude = (float)36.17;

            double oneMileLatitudeDegree = Math.pow(69.11, -1);
            double oneMileLongitudeDegree = Math.pow(69.11 * Math.cos(desiredLatitude), -1);
            float furthestDistance = (float)Math.sqrt(Math.pow(oneMileLatitudeDegree, 2) + Math.pow(oneMileLongitudeDegree, 2)) ;

            //Use 1 to view repetition of certain point, use 2 or greater to caue overflow
            int furthestDistanceMultiplier = 1;

            locationDataRTree.nearestN(new Point(desiredLongitude, desiredLatitude),
                    (new TIntProcedure() {
                        @Override
                        public boolean execute(int value) {
                            System.out.println("The id of a point near the desired one is: " + value);
                            return true;
                        }
                    }),10,  furthestDistance * furthestDistanceMultiplier);
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }

Handling multidimensional shapes

Hi JSI Team

First of all, you have done a great job. My suggestion is to convert the Rectangle object (2D x and y only) to Hyberplane object (multiple dimensions).

Thanks

Couldn't get MBRs of query results

Ok, for each query result a callback TIntProcedure.execute(int value) is invoked. You can get the node with

rtree.intersects(viewRect, new TIntProcedure()
{
@OverRide
public boolean execute(int value)
{
Node node = rtree.getNode(value);

            // Node has no public method to access its MBR which is really strange!
     }

}

Make nearestN, etc reentrant?

I noticed that the parents, parentsEntry, and priorityQueue members are cleared and used in several places. Making these local to their places of use would make these methods threadsafe. I'd be willing to do this if you would like.

Add JSI to Maven Central

The JSI project already has a pom.xml file, but it's not available in Maven Central.
Adding an extra maven repository is clunky, unreliable (if the server goes does our build is broken) and not always allowed in some company's.

Would you consider uploading the latest release to Maven Central. It's not that hard (especially because you already have a pom.xml file), just follow this guide:
http://central.sonatype.org/pages/ossrh-guide.html

RTree appears to not be threadsafe across reads

Thanks for the great library -- the indexing is fast and the library seems promising for our purposes.

It appears that RTree is not thread-safe across reads. I have multiple threads calling contains, and I get these stack traces:

java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 10
at gnu.trove.TIntArrayList.get(TIntArrayList.java:240)
at gnu.trove.TIntArrayList.remove(TIntArrayList.java:380)
at gnu.trove.TIntStack.pop(TIntStack.java:69)
at com.infomatiq.jsi.rtree.RTree.contains(RTree.java:600)

java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 10
at gnu.trove.TIntArrayList.get(TIntArrayList.java:240)
at gnu.trove.TIntStack.peek(TIntStack.java:78)
at com.infomatiq.jsi.rtree.RTree.contains(RTree.java:566)

When I synchronize the RTree instance before calling contains, I do not get the exceptions (which seem repeatable when not synchronized).

Do you expect RTree to be threadsafe across reads?

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.