RTree2D is a 2D immutable R-tree with STR (Sort-Tile-Recursive) packing for ultra-fast nearest and intersection queries

Overview

RTree2D

Actions Build TravisCI Build Coverage Status Scala Steward Scala.js Maven Central

RTree2D is a 2D immutable R-tree with STR (Sort-Tile-Recursive) packing for ultra-fast nearest and intersection queries.

Goals

Main our requirements was:

  • efficiency - we wanted the R-Tree to be able to search through millions of entries efficiently even in case of highly overlapped entries, also, we needed to be able to quickly rebuild R-tries with a per minute rate producing minimum pressure on GC
  • immutability - different threads needed to be able to work with the same R-tree without problems, at the same time some thread can build a new version of the R-tree reusing immutable entries from the previous version

To archive these goals we have used:

  • STR packing that is a one of the most efficient packing method which produces balanced R-tree
  • a memory representation and access patterns to it which are aware of a cache hierarchy of contemporary CPUs
  • an efficient TimSort version of merge sorting from Java which minimize access to memory during packing
  • efficient implementations of nearest and range search functions with minimum of virtual calls and allocations

How to use

Add the library to a dependency list:

libraryDependencies += "com.github.plokhotnyuk.rtree2d" %% "rtree2d-core" % "0.11.1"

Entries of R-tree are represented by RTreeEntry instances which contains payload and 4 coordinates of the minimum bounding rectangle (MBR) for it.

Add import, create entries, build an R-tree from them, and use it for search a nearest entry or search intersections by point or rectangle requests:

import com.github.plokhotnyuk.rtree2d.core._                                                         
import EuclideanPlane._                                                                  
                                                                                         
val box1 = entry(1.0f, 1.0f, 2.0f, 2.0f, "Box 1")                                        
val box2 = entry(2.0f, 2.0f, 3.0f, 3.0f, "Box 2")                                        
val entries = Seq(box1, box2)                                                            
                                                                                         
val rtree = RTree(entries)                                                               
                                                                                         
assert(rtree.entries == entries)                                                         
assert(rtree.nearestOption(0.0f, 0.0f) == Some(box1))                      
assert(rtree.nearestOption(0.0f, 0.0f, maxDist = 1.0f) == None)                          
assert(rtree.nearestK(0.0f, 0.0f, k = 1) == Seq(box1))                     
assert(rtree.nearestK(0.0f, 0.0f, k = 2, maxDist = 10f) == Seq(box2, box1))  
assert(rtree.searchAll(0.0f, 0.0f) == Nil)                                               
assert(rtree.searchAll(1.5f, 1.5f) == Seq(box1))                                         
assert(rtree.searchAll(2.5f, 2.5f) == Seq(box2))                                         
assert(rtree.searchAll(2.0f, 2.0f) == Seq(box1, box2))                                   
assert(rtree.searchAll(2.5f, 2.5f, 3.5f, 3.5f) == Seq(box2))                             
assert(rtree.searchAll(1.5f, 1.5f, 2.5f, 2.5f).forall(entries.contains))                 

RTree2D can be used for indexing spherical coordinates, where X-axis is used for latitudes, and Y-axis for longitudes in degrees. Result distances are in kilometers:

import com.github.plokhotnyuk.rtree2d.core._
import SphericalEarth._

val city1 = entry(50.0614f, 19.9383f, "Kraków")
val city2 = entry(50.4500f, 30.5233f, "Kyiv")
val entries = Seq(city1, city2)

val rtree = RTree(entries, nodeCapacity = 4/* the best capacity for nearest queries for spherical geometry */)

assert(rtree.entries == entries)
assert(rtree.nearestOption(0.0f, 0.0f) == Some(city1))
assert(rtree.nearestOption(50f, 20f, maxDist = 1.0f) == None)
assert(rtree.nearestK(50f, 20f, k = 1) == Seq(city1))
assert(rtree.nearestK(50f, 20f, k = 2, maxDist = 1000f) == Seq(city2, city1))
assert(rtree.searchAll(50f, 30f, 51f, 31f) == Seq(city2))
assert(rtree.searchAll(0f, -180f, 90f, 180f).forall(entries.contains))

Precision of 32-bit float number allows to locate points with a maximum error ±1 meter at anti-meridian.

Used spherical model of the Earth with the Mean radius and Haversine formula allow to get ±0.3% accuracy in calculation of distances comparing with Vincenty’s formulae on an oblate spheroid model.

Please, check out Scala docs in sources and tests for other functions which allows filtering or accumulating found entries without allocations.

How it works

Charts below are latest results of benchmarks which compare RTree2D with Archery, David Monten's rtree, and JTS libraries on the following environment: Intel® Core™ i7-7700 CPU @ 3.6GHz (max 4.2GHz), RAM 16Gb DDR4-2400, Ubuntu 18.04, Oracle JDK 11.

Main metric tested by benchmarks is an execution time in nanoseconds. So lesser values are better. Please, check out the Run benchmarks section bellow how to test other metrics like allocations in bytes or number of some CPU events.

Benchmarks have the following parameters:

  • geometry to switch geometry between plane and spherical (currently available only for the RTree2D library)
  • nearestMax a maximum number of entries to return for nearest query
  • nodeCapacity a maximum number of children nodes (BEWARE: Archery use hard coded 50 for limiting a number of children nodes)
  • overlap is a size of entries relative to interval between them
  • partToUpdate a part of RTree to update
  • rectSize is a size of rectangle request relative to interval between points
  • shuffle is a flag to turn on/off shuffling of entries before R-tree building
  • size is a number of entries in the R-tree

The apply benchmark tests building of R-tries from a sequence of entires.

apply

The nearest benchmark tests search an entry of the R-tree that is nearest to the specified point.

nearest

The nearestK benchmark tests search up to 10 entries in the R-tree that are nearest to the specified point.

nearest

The searchByPoint benchmark tests requests that search entries with intersects with the specified point.

searchByPoint

The searchByRectangle benchmark tests requests that search entries with intersects with the specified rectangle that can intersect with up to 100 entries.

searchByRectangle

The entries benchmark tests returning of all entries that are indexed in the R-tree.

entries

The update benchmark tests rebuild of R-tree with removing of +10% entries and adding of +10% another entries to it.

update

Charts with their results are available in subdirectories (each for different value of overlap parameter) of the docs directory.

How to contribute

Build

To compile, run tests, check coverage for different Scala versions use a command:

sbt clean +test
sbt clean coverage test coverageReport mimaReportBinaryIssues

Run benchmarks

Benchmarks are developed in the separated module using Sbt plugin for JMH tool.

Feel free to modify benchmarks and check how it works with your data, JDK, and Scala versions.

To see throughput with allocation rate run benchmarks with GC profiler using the following command:

sbt -java-home /usr/lib/jvm/jdk1.8.0 clean 'rtree2d-benchmark/jmh:run -prof gc -rf json -rff rtries.json .*'

It will save benchmark report in rtree2d-benchmark/rtries.json file.

Results that are stored in JSON can be easy plotted in JMH Visualizer by drugging & dropping of your file(s) to the drop zone or using the source or sources parameters with an HTTP link to your file(s) in the URLs: http://jmh.morethan.io/?source=<link to json file> or http://jmh.morethan.io/?sources=<link to json file1>,<link to json file2>.

Also, there is an ability to run benchmarks and visualize results with a charts command. It adds -rf and -rff options to all passes options and supply them to jmh:run task, then group results per benchmark and plot main score series to separated images. Here is an example how it can be called for specified version of JVM, value of the overlap parameter, and patterns of benchmark names:

sbt -java-home /usr/lib/jvm/jdk1.8.0 clean 'charts -jvm /usr/lib/jvm/jdk-11/bin/java -p overlap=1 -p rectSize=10 -p nearestMax=10 -p nodeCapacity=16 -p partToUpdate=0.1 -p geometry=plane .*'

Results will be places in a cross-build suffixed subdirectory of the benchmark/target directory in *.png files (one file with a chart for each benchmark):

$ ls rtree2d-benchmark/target/scala-2.12/*.png

rtree2d-benchmark/target/scala-2.12/apply[geometry=plane,nearestMax=10,nodeCapacity=16,overlap=1,partToUpdate=0.1,rectSize=10].png
...
rtree2d-benchmark/target/scala-2.12/searchByRectangle[geometry=plane,nearestMax=10,nodeCapacity=16,overlap=1,partToUpdate=0.1,rectSize=10].png

For testing of RTree2D with spherical geometry and different node capacities use the following command (chart files will be placed in the same directory as above):

sbt -java-home /usr/lib/jvm/jdk1.8.0 clean 'charts -jvm /usr/lib/jvm/jdk-11/bin/java -p overlap=1 -p rectSize=10 -p nearestMax=10 -p nodeCapacity=4,8,16 -p partToUpdate=0.1 -p geometry=spherical RTree2D.*'

Publish locally

Publish to local Ivy repo:

sbt +publishLocal

Publish to local Maven repo:

sbt +publishM2

Release

For version numbering use Recommended Versioning Scheme that is used in the Scala ecosystem.

Double check binary and source compatibility, including behavior, and release using the following command (credentials are required):

sbt release

Do not push changes to github until promoted artifacts for the new version are not available for download on Maven Central Repository to avoid binary compatibility check failures in triggered Travis CI builds.

Comments
  • findNearestOption does not find point within a distance in particular situations

    findNearestOption does not find point within a distance in particular situations

    Andriy, first of all, I really admire the work you've done on this library. The performance is amazing.

    I found one issue which is related to the algorithm of searching nearest points. I have a tree constructed with nodeCapacity = 4, distance calculator is SphericalEarth. The tree is represented as below:

    RTreeNode(-26.05,21.64581,-17.80165,27.84296)
        RTreeNode(-26.05,21.64581,-17.80165,25.91667)
          RTreeNode(-21.69785,21.64581,-18.36536,23.41667)
            RTreeEntry(-21.69785,21.64581,-21.69785,21.64581,BWGNZ)
            RTreeEntry(-18.36536,21.84219,-18.36536,21.84219,BWSWX)
            RTreeEntry(-21.66667,22.05,-21.66667,22.05,BWSUN)
            RTreeEntry(-19.98333,23.41667,-19.98333,23.41667,BWMUB)
          RTreeNode(-26.05,21.77962,-23.9988,25.67728)
            RTreeEntry(-23.9988,21.77962,-23.9988,21.77962,BWHUK)
            RTreeEntry(-26.05,22.45,-26.05,22.45,BWTBY)
            RTreeEntry(-24.60167,24.72806,-24.60167,24.72806,BWJWA)
            RTreeEntry(-25.22435,25.67728,-25.22435,25.67728,BWLOQ)
          RTreeNode(-21.41494,23.75201,-17.80165,25.59263)
            RTreeEntry(-19.16422,23.75201,-19.16422,23.75201,BWKHW)
            RTreeEntry(-17.80165,25.16024,-17.80165,25.16024,BWBBK)
            RTreeEntry(-21.3115,25.37642,-21.3115,25.37642,BWORP)
            RTreeEntry(-21.41494,25.59263,-21.41494,25.59263,BWLET)
          RTreeNode(-24.87158,25.86556,-24.62694,25.91667)
            RTreeEntry(-24.62694,25.86556,-24.62694,25.86556,BWMGS)
            RTreeEntry(-24.87158,25.86989,-24.87158,25.86989,BWRSA)
            RTreeEntry(-24.65451,25.90859,-24.65451,25.90859,BWGBE)
            RTreeEntry(-24.66667,25.91667,-24.66667,25.91667,BWGAB)
        RTreeNode(-23.10275,26.71077,-21.17,27.84296)
          RTreeNode(-23.10275,26.71077,-21.97895,27.84296)
            RTreeEntry(-22.38754,26.71077,-22.38754,26.71077,BWSER)
            RTreeEntry(-23.10275,26.83411,-23.10275,26.83411,BWMAH)
            RTreeEntry(-22.54605,27.12507,-22.54605,27.12507,BWPAL)
            RTreeEntry(-21.97895,27.84296,-21.97895,27.84296,BWPKW)
          RTreeNode(-21.17,27.50778,-21.17,27.50778)
            RTreeEntry(-21.17,27.50778,-21.17,27.50778,BWFRW)
    

    When searching for the nearest point to -24.65527, 25.91904 with the maxDist parameter set to 50 km, I am expecting the tree to return Some(RTreeEntry(-24.65451,25.90859,-24.65451,25.90859,BWGBE)). However, the method returns None. If I maxDist is set to infinity all works fine.

    I did some investigation and the situation can be represented graphically like below: image image

    A is the point that I'm looking for the nearest objects, and B is the expected closest object.

    bug 
    opened by jaceksokol 3
  • Incorrect distance calculation / can't express box in Western Hemisphere?

    Incorrect distance calculation / can't express box in Western Hemisphere?

    val innerBox: RTreeEntry[String] = entry[String](17.84f, -67.38f, 18.62f, -65.51f, "innerBox")
    
    innerBox.asJson.toString()
    
    val h_latitude = 18.0f
    val h_longditude = -74.3f
    
    SphericalEarth.distanceCalculator.distance(h_latitude, h_longditude, innerBox)
    

    This produces an answer of zero, which I think is "wrong" (or at least, not what I want)

    what I think is happening, is that the -ve longitude constraint is going "the wrong way" around the world. However, I can't switch the numbers around, because the library complains at me.

    Any hint on how this might work?

    bug 
    opened by Quafadas 2
  • java.lang.ClassCastException: com.github.plokhotnyuk.rtree2d.core.RTreeNode cannot be cast to com.github.plokhotnyuk.rtree2d.core.RTreeEntry

    java.lang.ClassCastException: com.github.plokhotnyuk.rtree2d.core.RTreeNode cannot be cast to com.github.plokhotnyuk.rtree2d.core.RTreeEntry

    Hi!

    Not sure if this is a good place to ask, but I am kind of stuck.

    We've been using rtree2d without any issues for roughly 1.5 years. Suddenly, this error keeps appearing randomly when using .nearestK():

    java.lang.ClassCastException: com.github.plokhotnyuk.rtree2d.core.RTreeNode cannot be cast to com.github.plokhotnyuk.rtree2d.core.RTreeEntry
    	at com.github.plokhotnyuk.rtree2d.core.RTreeNode.nearest(RTree.scala:364)
    	at com.github.plokhotnyuk.rtree2d.core.RTreeNode.nearest(RTree.scala:378)
    	at com.github.plokhotnyuk.rtree2d.core.RTreeNode.nearest(RTree.scala:378)
    	at com.github.plokhotnyuk.rtree2d.core.RTree$$anon$3.<init>(RTree.scala:204)
    	at com.github.plokhotnyuk.rtree2d.core.RTree.nearestK(RTree.scala:203)
    	at com.github.plokhotnyuk.rtree2d.core.RTree.nearestK$(RTree.scala:200)
    	at com.github.plokhotnyuk.rtree2d.core.RTreeNode.nearestK(RTree.scala:353)
           [...omitted...]
    	at akka.actor.typed.internal.BehaviorImpl$ReceiveMessageBehavior.receive(BehaviorImpl.scala:150)
    	at akka.actor.typed.Behavior$.interpret(Behavior.scala:274)
    	at akka.actor.typed.Behavior$.interpretMessage(Behavior.scala:230)
    	at akka.actor.typed.internal.adapter.ActorAdapter.handleMessage(ActorAdapter.scala:126)
    	at akka.actor.typed.internal.adapter.ActorAdapter.aroundReceive(ActorAdapter.scala:106)
    	at akka.actor.ActorCell.receiveMessage(ActorCell.scala:573)
    	at akka.actor.ActorCell.invoke(ActorCell.scala:543)
    	at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:269)
    	at akka.dispatch.Mailbox.run(Mailbox.scala:230)
    	at akka.dispatch.Mailbox.exec(Mailbox.scala:242)
    	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
    	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
    	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
    	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
    

    Sadly, I've not been able to reproduce it locally, or even by querying our service for locations which seemingly led to the crash.

    The tree should contain less than 20k entries. This number has not increased significantly in the past few months. The tree is constructed with the default capacity. k is set to 10, maxDist varies in the 3000m range.

    rtree2d version: 0.9.0 (can't spot any code changes in that area) Scala version: 2.13.2 Java version: 8 (Amazon Coretto)

    Has this been encountered before? Any pointers towards how we could mitigate this would be much appreciated!

    bug 
    opened by JonasAckermann 2
  • NoSuchMethod error creating entries in Scala 2.11.12 / Spark 2.4.3

    NoSuchMethod error creating entries in Scala 2.11.12 / Spark 2.4.3

    Hi, when trying the examples in the readme I run into this following error. I have downloaded the jar to my local maven repo.

    • Spark 2.4.3
    • Scala 2.11.12
    scala> import com.sizmek.rtree2d.core._
    import com.sizmek.rtree2d.core._
    
    scala> import SphericalEarth._
    import SphericalEarth._
    
    scala> val city1 = entry(50.0614f, 19.9383f, "Krakow")
    java.lang.NoSuchMethodError: scala.Product.$init$(Lscala/Product;)V
      at com.sizmek.rtree2d.core.RTreeEntry.<init>(RTree.scala:332)
      at com.sizmek.rtree2d.core.Spherical.entry(Geometry.scala:107)
      at com.sizmek.rtree2d.core.Spherical.entry$(Geometry.scala:102)
      at com.sizmek.rtree2d.core.SphericalEarth$.entry(Geometry.scala:230)
      ... 53 elided
    
    opened by arjtala 2
  • Update jsoniter-scala-macros to 2.20.0

    Update jsoniter-scala-macros to 2.20.0

    Updates com.github.plokhotnyuk.jsoniter-scala:jsoniter-scala-macros from 2.19.1 to 2.20.0. GitHub Release Notes - Version Diff

    I'll automatically update this PR to resolve conflicts as long as you don't change it yourself.

    If you'd like to skip this version, you can just close this PR. If you have any feedback, just mention me in the comments below.

    Configure Scala Steward for your repository with a .scala-steward.conf file.

    Have a fantastic day writing Scala!

    Adjust future updates

    Add this to your .scala-steward.conf file to ignore future updates of this dependency:

    updates.ignore = [ { groupId = "com.github.plokhotnyuk.jsoniter-scala", artifactId = "jsoniter-scala-macros" } ]
    

    Or, add this to slow down future updates of this dependency:

    dependencyOverrides = [{
      pullRequests = { frequency = "@monthly" },
      dependency = { groupId = "com.github.plokhotnyuk.jsoniter-scala", artifactId = "jsoniter-scala-macros" }
    }]
    

    labels: library-update, early-semver-minor, semver-spec-minor, commit-count:1

    opened by scala-steward 1
  • Update nscplugin, sbt-scala-native, ... to 0.4.8

    Update nscplugin, sbt-scala-native, ... to 0.4.8

    Updates

    from 0.4.7 to 0.4.8. GitHub Release Notes - Version Diff

    I'll automatically update this PR to resolve conflicts as long as you don't change it yourself.

    If you'd like to skip this version, you can just close this PR. If you have any feedback, just mention me in the comments below.

    Configure Scala Steward for your repository with a .scala-steward.conf file.

    Have a fantastic day writing Scala!

    Adjust future updates

    Add this to your .scala-steward.conf file to ignore future updates of this dependency:

    updates.ignore = [ { groupId = "org.scala-native" } ]
    

    Or, add this to slow down future updates of this dependency:

    dependencyOverrides = [{
      pullRequests = { frequency = "@monthly" },
      dependency = { groupId = "org.scala-native" }
    }]
    

    labels: library-update, early-semver-minor, semver-spec-patch, commit-count:1

    opened by scala-steward 1
  • Update jsoniter-scala-macros to 2.17.2

    Update jsoniter-scala-macros to 2.17.2

    Updates com.github.plokhotnyuk.jsoniter-scala:jsoniter-scala-macros from 2.17.1 to 2.17.2. GitHub Release Notes - Version Diff

    I'll automatically update this PR to resolve conflicts as long as you don't change it yourself.

    If you'd like to skip this version, you can just close this PR. If you have any feedback, just mention me in the comments below.

    Configure Scala Steward for your repository with a .scala-steward.conf file.

    Have a fantastic day writing Scala!

    Adjust future updates

    Add this to your .scala-steward.conf file to ignore future updates of this dependency:

    updates.ignore = [ { groupId = "com.github.plokhotnyuk.jsoniter-scala", artifactId = "jsoniter-scala-macros" } ]
    

    Or, add this to slow down future updates of this dependency:

    dependencyOverrides = [{
      pullRequests = { frequency = "@monthly" },
      dependency = { groupId = "com.github.plokhotnyuk.jsoniter-scala", artifactId = "jsoniter-scala-macros" }
    }]
    

    labels: library-update, early-semver-patch, semver-spec-patch, commit-count:1

    opened by scala-steward 1
  • Update jsoniter-scala-macros to 2.14.0

    Update jsoniter-scala-macros to 2.14.0

    Updates com.github.plokhotnyuk.jsoniter-scala:jsoniter-scala-macros from 2.13.39 to 2.14.0. GitHub Release Notes - Version Diff

    I'll automatically update this PR to resolve conflicts as long as you don't change it yourself.

    If you'd like to skip this version, you can just close this PR. If you have any feedback, just mention me in the comments below.

    Configure Scala Steward for your repository with a .scala-steward.conf file.

    Have a fantastic day writing Scala!

    Adjust future updates

    Add this to your .scala-steward.conf file to ignore future updates of this dependency:

    updates.ignore = [ { groupId = "com.github.plokhotnyuk.jsoniter-scala", artifactId = "jsoniter-scala-macros" } ]
    

    Or, add this to slow down future updates of this dependency:

    dependencyOverrides = [{
      pullRequests = { frequency = "@monthly" },
      dependency = { groupId = "com.github.plokhotnyuk.jsoniter-scala", artifactId = "jsoniter-scala-macros" }
    }]
    

    labels: library-update, early-semver-minor, semver-spec-minor, commit-count:1

    opened by scala-steward 1
  • Update jsoniter-scala-macros to 2.13.23

    Update jsoniter-scala-macros to 2.13.23

    Updates com.github.plokhotnyuk.jsoniter-scala:jsoniter-scala-macros from 2.13.20 to 2.13.23. GitHub Release Notes - Version Diff

    I'll automatically update this PR to resolve conflicts as long as you don't change it yourself.

    If you'd like to skip this version, you can just close this PR. If you have any feedback, just mention me in the comments below.

    Configure Scala Steward for your repository with a .scala-steward.conf file.

    Have a fantastic day writing Scala!

    Adjust future updates

    Add this to your .scala-steward.conf file to ignore future updates of this dependency:

    updates.ignore = [ { groupId = "com.github.plokhotnyuk.jsoniter-scala", artifactId = "jsoniter-scala-macros" } ]
    

    Or, add this to slow down future updates of this dependency:

    dependencyOverrides = [{
      pullRequest = { frequency = "@monthly" },
      dependency = { groupId = "com.github.plokhotnyuk.jsoniter-scala", artifactId = "jsoniter-scala-macros" }
    }]
    

    labels: library-update, early-semver-patch, semver-spec-patch, commit-count:1

    opened by scala-steward 1
  • Update jsoniter-scala-macros to 2.13.22

    Update jsoniter-scala-macros to 2.13.22

    Updates com.github.plokhotnyuk.jsoniter-scala:jsoniter-scala-macros from 2.13.20 to 2.13.22.

    I'll automatically update this PR to resolve conflicts as long as you don't change it yourself.

    If you'd like to skip this version, you can just close this PR. If you have any feedback, just mention me in the comments below.

    Configure Scala Steward for your repository with a .scala-steward.conf file.

    Have a fantastic day writing Scala!

    Adjust future updates

    Add this to your .scala-steward.conf file to ignore future updates of this dependency:

    updates.ignore = [ { groupId = "com.github.plokhotnyuk.jsoniter-scala", artifactId = "jsoniter-scala-macros" } ]
    

    Or, add this to slow down future updates of this dependency:

    dependencyOverrides = [{
      pullRequest = { frequency = "@monthly" },
      dependency = { groupId = "com.github.plokhotnyuk.jsoniter-scala", artifactId = "jsoniter-scala-macros" }
    }]
    

    labels: library-update, early-semver-patch, semver-spec-patch, commit-count:1

    opened by scala-steward 1
  • Update jsoniter-scala-macros to 2.13.21

    Update jsoniter-scala-macros to 2.13.21

    Updates com.github.plokhotnyuk.jsoniter-scala:jsoniter-scala-macros from 2.13.20 to 2.13.21. GitHub Release Notes - Version Diff

    I'll automatically update this PR to resolve conflicts as long as you don't change it yourself.

    If you'd like to skip this version, you can just close this PR. If you have any feedback, just mention me in the comments below.

    Configure Scala Steward for your repository with a .scala-steward.conf file.

    Have a fantastic day writing Scala!

    Adjust future updates

    Add this to your .scala-steward.conf file to ignore future updates of this dependency:

    updates.ignore = [ { groupId = "com.github.plokhotnyuk.jsoniter-scala", artifactId = "jsoniter-scala-macros" } ]
    

    Or, add this to slow down future updates of this dependency:

    dependencyOverrides = [{
      pullRequest = { frequency = "@monthly" },
      dependency = { groupId = "com.github.plokhotnyuk.jsoniter-scala", artifactId = "jsoniter-scala-macros" }
    }]
    

    labels: library-update, early-semver-patch, semver-spec-patch, commit-count:1

    opened by scala-steward 1
  • Support Consumer<RTreeEntry[A]> as alternative to returning a Seq?

    Support Consumer as alternative to returning a Seq?

    Thank you for this tool. Very useful. I am using it from Java.

    For the methods that return a Seq<RTreeEntry>, it would be nice to have corresponding methods that accept an additional Consumer<RTreeEntry> argument and return void.

    That would avoid the memory allocation of a large List/Seq when possible. Possible?

    enhancement 
    opened by RichMacDonald 0
  • R-tree serialization support

    R-tree serialization support

    R-tree serialization could be a pretty nice extra feature to support as a part of this fantastic tiny library.

    Is there any interest in such kind of functionality support, or that was intentionally not implemented? Could be nice to establish / contribute into some sort of a standard for the R-tree serialization format (if there is no such yet).

    // definitely a feature request / enhancement / help wanted issue

    question 
    opened by pomadchin 2
  • Line / box intersections?

    Line / box intersections?

    I'm not sure if I'm missing something obvious, but is it possible to calculate the intersections of a line (specified by lat/long start) with a box on a spherical earth?

    I can only see point / box interactions?

    question 
    opened by Quafadas 6
  • Check packing speed and efficiency of requests with Hilbert curve packing

    Check packing speed and efficiency of requests with Hilbert curve packing

    https://github.com/mourner/flatbush/issues/8

    https://github.com/mourner/flatbush/blob/master/README.md

    https://github.com/rawrunprotected/hilbert_curves/blob/master/hilbert_curves.cpp

    question 
    opened by plokhotnyuk 0
  • Allow use of any numeric type to store the R-tree instead of just Float

    Allow use of any numeric type to store the R-tree instead of just Float

    It would be nice if more numeric types were supported instead of just Float, e.g. Double, Int, Long, BigInt, BigDecimal. Can the numeric type be generalized? This would be useful for image manipulatoin tasks where fractional numbers are not possible.

    help wanted question 
    opened by benwbooth 1
Releases(v0.11.12)
  • v0.11.12(Oct 13, 2022)

    • Tune Scala.js build for a smaller bundle and better efficiency in runtime
    • Add versionScheme property for Maven poms
    • Update Scala 3.x to 3.2.0
    • Update Scala 2.13.x to 2.13.10
    • Update Scala 2.12.x to 2.12.17
    • Update Scala.js to 1.11.0
    • Update Scala Native to 0.4.7

    All changes https://github.com/plokhotnyuk/rtree2d/compare/v0.11.11...v0.11.12

    Source code(tar.gz)
    Source code(zip)
  • v0.11.11(Jun 27, 2022)

    • Add Scala Native support for Scala 3
    • Update Scala 3.x to 3.1.3
    • Update Scala 2.12.x to 2.12.16
    • Update Scala.js to 1.10.1

    All changes https://github.com/plokhotnyuk/rtree2d/compare/v0.11.10...v0.11.11

    Source code(tar.gz)
    Source code(zip)
  • v0.11.10(Feb 15, 2022)

    • Update Scala 3.x to 3.1.1
    • Update Scala.js to 1.9.0
    • Switch Scala.js target from ES 5.1 to ES 2015
    • Drop of Scala 2.11.x support

    All changes https://github.com/plokhotnyuk/rtree2d/compare/v0.11.9...v0.11.10

    Source code(tar.gz)
    Source code(zip)
  • v0.11.9(Sep 24, 2021)

    • More efficient creation of RTree and searching nearest for spherical coordinates

    All changes https://github.com/plokhotnyuk/rtree2d/compare/v0.11.8...v0.11.9

    Source code(tar.gz)
    Source code(zip)
  • v0.11.8(Sep 20, 2021)

    • Fix #292 by proper calculation of the extreme latitude for the spherical geomenry
    • Update Scala 2.12.x to 2.12.15 and Scala 3 to 3.0.2

    All changes https://github.com/plokhotnyuk/rtree2d/compare/v0.11.7...v0.11.8

    Source code(tar.gz)
    Source code(zip)
  • v0.11.7(May 25, 2021)

  • v0.11.6(May 21, 2021)

  • v0.11.5(Apr 27, 2021)

    • Added Scala 3 support for rtree-coreJS
    • Update Scala 3 to 3.0.0-RC3

    All changes https://github.com/plokhotnyuk/rtree2d/compare/v0.11.4...v0.11.5

    Source code(tar.gz)
    Source code(zip)
  • v0.11.4(Apr 11, 2021)

  • v0.11.3(Apr 9, 2021)

  • v0.11.2(Apr 1, 2021)

    • Update Scala 3.x to 3.0.0-RC2, Scala 2.13.x to 2.13.5, and Scala 2.12.x to 2.12.13
    • Update Scala.js to 1.5.1

    All changes https://github.com/Sizmek/rtree2d/compare/v0.11.1...v0.11.2

    Source code(tar.gz)
    Source code(zip)
  • v0.11.1(Aug 4, 2020)

    • Fix #176 by not allowing RTreeEntry and RTreeNode on the same level of the RTree

    All changes https://github.com/Sizmek/rtree2d/compare/v0.11.0...v0.11.1

    Source code(tar.gz)
    Source code(zip)
  • v0.11.0(Jun 20, 2020)

    • Fix #168 by restoring sorting by X and Y axes when packing
    • Update sbt-scalajs, scalajs-compiler to 1.1.0
    • Update Dotty to 0.24.0-RC1

    All changes https://github.com/Sizmek/rtree2d/compare/v0.10.0...v0.11.0

    Source code(tar.gz)
    Source code(zip)
  • v0.10.0(May 11, 2020)

  • v0.9.0(Jun 7, 2019)

    • Package renaming from com.sizmek to com.github.plokhotnyuk
    • Moving to the Maven Central
    • Cross-build for Scala 2.13.0 release

    All changes https://github.com/Sizmek/rtree2d/compare/v0.8.0...v0.9.0

    Source code(tar.gz)
    Source code(zip)
  • v0.8.0(Jun 7, 2019)

    • Cross-build for Scala 2.13.0-RC1
    • More efficient packing using branch less intrinsics for Math.min/Math.max

    All changes https://github.com/Sizmek/rtree2d/compare/v0.7.1...v0.8.0

    Source code(tar.gz)
    Source code(zip)
  • v0.7.1(Jan 28, 2019)

  • v0.7.0(Jan 28, 2019)

  • v0.6.1(Jan 28, 2019)

  • v0.6.0(Jul 6, 2018)

    • Add rtree2d- prefix to module and artifact names
    • Add function for calculation of distance to the center of ellipsoidal model of the Earth
    • Simplify calculations of distances for spherical model
    • Add entry constructor for spheres with different radiuses
    • Use IndexOutOfBoundsException instead of ArrayIndexOutOfBoundsException
    • Rename x1, y1, x2, y2 fields of entries to minX, minY, maxX, maxY
    • Move constant parameters to the benchmark title
    • Uncomment all benchmark parameters
    • Fix nearestK benchmark for David Moten's R-Tree
    • Add JTS benchmarks

    All changes https://github.com/Sizmek/rtree2d/compare/v0.5.0...v0.6.0

    Source code(tar.gz)
    Source code(zip)
  • v0.5.0(Jun 22, 2018)

    • Rename nearest query to nearestOption and simplify it to return an entry option instead of option of tuple for the entry and distance to it
    • Add nearestK query for search up to K of nearest entries
    • Add nearest query to allow custom filtering or/and aggregation of entries during search
    • Simplify f parameter function of custom search queries to return Unit instead of Boolean
    • Extract array wrappers to separated (non inner) classes to avoid possible memory leaks due holding of reference on R-tree instance

    All changes https://github.com/Sizmek/rtree2d/compare/v0.4.0...v0.5.0

    Source code(tar.gz)
    Source code(zip)
  • v0.4.0(Jun 20, 2018)

    • Added constructors of entries for plane and spherical geometries
    • RTree2D API changed: constructor methods for entries separated and moved to different namespaces for plane and spherical geometries (EuclideanPlane and SphericalEarth objects accordingly); returned collections are IndexedSeq now (was Seq); collections of entries for packing and update are Iterable now (was Traversable)
    • Improved error messages in constructors for entries

    All changes https://github.com/Sizmek/rtree2d/compare/v0.3.1...v0.4.0

    Source code(tar.gz)
    Source code(zip)
  • v0.3.1(Jun 19, 2018)

    • Fix of #8 by switching to more expensive calculations of distance from a point to the bounding box with the SphericalEarthDistanceCalculator, now it requires ~20 microseconds to find the nearest entry for 1M entry R-tries that are packed with nodeCapacity = 4 (see the chart below)

    All changes https://github.com/Sizmek/rtree2d/compare/v0.3.0...v0.3.1

    image

    Source code(tar.gz)
    Source code(zip)
  • v0.3.0(Jun 18, 2018)

    • Replace RTree.merge and RTree.diff functions by a more efficient RTree.update which allows to remove and add entries with a one subsequent bulk packing.
    • Add the nearest function to search a nearest entry for the given point.
    • Add ability to use RTree for indexing of spherical coordinates, where X-axis is used for latitudes, and Y-axis for longitudes in degrees. Result distances of the nearest function output are in kilometers.

    All changes https://github.com/Sizmek/rtree2d/compare/v0.2.0...v0.3.0

    Source code(tar.gz)
    Source code(zip)
  • v0.2.0(Jun 15, 2018)

    • Add RTree.merge and RTree.diff function for efficient bulk inserting or removing of entries.
    • Remove redundant dependency on scala-reflect library.
    • More efficient build of R-tree and searching by point and rectangle.

    All changes https://github.com/Sizmek/rtree2d/compare/v0.1.0...v0.2.0

    Source code(tar.gz)
    Source code(zip)
  • v0.1.0(May 8, 2018)

Owner
Andriy Plokhotnyuk
Andriy Plokhotnyuk
Immutable key/value store with efficient space utilization and fast reads. They are ideal for the use-case of tables built by batch processes and shipped to multiple servers.

Minimal Perfect Hash Tables About Minimal Perfect Hash Tables are an immutable key/value store with efficient space utilization and fast reads. They a

Indeed Engineering 92 Nov 22, 2022
Persistent (immutable) collections for Java and Kotlin

What are Dexx Collections? Dexx Collections are a port of Scala's immutable, persistent collection classes to pure Java. Persistent in the context of

Andrew O'Malley 208 Sep 30, 2022
A fast object pool for the JVM

Stormpot Stormpot is an object pooling library for Java. Use it to recycle objects that are expensive to create. The library will take care of creatin

Chris Vest 302 Nov 14, 2022
Fast integer compression in C using the StreamVByte codec

streamvbyte StreamVByte is a new integer compression technique that applies SIMD instructions (vectorization) to Google's Group Varint approach. The n

Daniel Lemire 281 Dec 27, 2022
Fast campus 강의 '현실 세상의 TDD' 실습에 사용된 예제 코드를 제공합니다.

현실 세상의 TDD 실습 코드 Fast campus 강의 '현실 세상의 TDD' 실습에 사용된 예제 코드를 제공합니다. 예제 코드는 강의 촬영 전에 미리 준비되었고 강의 촬영 시 라이브 코딩이 진행되었기 때문에 세부 코드는 강의 영상에서 보는 것과 다를 수 있습니다.

Gyuwon Yi 170 Jan 2, 2023
Simple, fast Key-Value storage. Inspired by HaloDB

Phantom Introduction Phantom is an embedded key-value store, provides extreme high write throughput while maintains low latency data access. Phantom w

null 11 Apr 14, 2022
Table-Computing (Simplified as TC) is a distributed light weighted, high performance and low latency stream processing and data analysis framework. Milliseconds latency and 10+ times faster than Flink for complicated use cases.

Table-Computing Welcome to the Table-Computing GitHub. Table-Computing (Simplified as TC) is a distributed light weighted, high performance and low la

Alibaba 34 Oct 14, 2022
Eclipse Collections is a collections framework for Java with optimized data structures and a rich, functional and fluent API.

English | 中文 | Deutsch | Español | Ελληνικά | Français | 日本語 | Norsk (bokmål) | Português-Brasil | Русский | हिंदी Eclipse Collections is a comprehens

Eclipse Foundation 2.1k Dec 29, 2022
A Java library for quickly and efficiently parsing and writing UUIDs

fast-uuid fast-uuid is a Java library for quickly and efficiently parsing and writing UUIDs. It yields the most dramatic performance gains when compar

Jon Chambers 142 Jan 1, 2023
gRPC and protocol buffers for Android, Kotlin, and Java.

Wire “A man got to have a code!” - Omar Little See the project website for documentation and APIs. As our teams and programs grow, the variety and vol

Square 3.9k Jan 5, 2023
The Java collections framework provides a set of interfaces and classes to implement various data structures and algorithms.

Homework #14 Table of Contents General Info Technologies Used Project Status Contact General Information Homework contains topics: Sorting an ArrayLis

Mykhailo 1 Feb 12, 2022
High Performance data structures and utility methods for Java

Agrona Agrona provides a library of data structures and utility methods that are a common need when building high-performance applications in Java. Ma

Real Logic 2.5k Jan 5, 2023
Replicate your Key Value Store across your network, with consistency, persistance and performance.

Chronicle Map Version Overview Chronicle Map is a super-fast, in-memory, non-blocking, key-value store, designed for low-latency, and/or multi-process

Chronicle Software : Open Source 2.5k Dec 29, 2022
Fault tolerance and resilience patterns for the JVM

Failsafe Failsafe is a lightweight, zero-dependency library for handling failures in Java 8+, with a concise API for handling everyday use cases and t

Jonathan Halterman 3.9k Jan 2, 2023
fasttuple - Collections that are laid out adjacently in both on- and off-heap memory.

FastTuple Introduction There are lots of good things about working on the JVM, like a world class JIT, operating system threads, and a world class gar

BMC TrueSight Pulse (formerly Boundary) 137 Sep 30, 2022
Hollow is a java library and toolset for disseminating in-memory datasets from a single producer to many consumers for high performance read-only access.

Hollow Hollow is a java library and toolset for disseminating in-memory datasets from a single producer to many consumers for high performance read-on

Netflix, Inc. 1.1k Dec 25, 2022
A fork of Cliff Click's High Scale Library. Improved with bug fixes and a real build system.

High Scale Lib This is Boundary's fork of Cliff Click's high scale lib. We will be maintaining this fork with bug fixes, improvements and versioned bu

BMC TrueSight Pulse (formerly Boundary) 402 Jan 2, 2023