Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/main/scala/spatialspark/index/STIndex.scala
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ object STIndex {
}
}

case class Wrapped[A](elem: A)(implicit ordering: Ordering[A])
extends Ordered[Wrapped[A]] {
def compare(that: Wrapped[A]): Int = ordering.compare(this.elem, that.elem)
}
// case class Wrapped[A](elem: A)(implicit ordering: Ordering[A])
// extends Ordered[Wrapped[A]] {
// def compare(that: Wrapped[A]): Int = ordering.compare(this.elem, that.elem)
// }

/**
* Generate partitions from sample MBRs
Expand All @@ -67,8 +67,9 @@ object STIndex {
//sort by center_x, slice, center_y
val centroids = sampleData.map(x => ((x.xmin + x.xmax) / 2.0, (x.ymin + x.ymax) / 2.0))
val objs = centroids.sortByKey(true).zipWithIndex().map(x => (x._1._1, x._1._2, x._2))
val objectsSorted = objs.map(x=>(Wrapped(x._3/numObjectsPerSlice, x._2), x))
.sortByKey(true).values
// val objectsSorted = objs.map(x=>(Wrapped(x._3/numObjectsPerSlice, x._2), x))
// .sortByKey(true).values
val objectsSorted = objs.map(x => ((x._3 / numObjectsPerSlice, x._2), x)).sortByKey(true).values

//pack
val tiles = objectsSorted.zipWithIndex().map(x => (x._2/numObjectsPerTile,
Expand Down