syoummer / SpatialSpark

Big Spatial Data Processing using Spark

Home Page:http://simin.me/projects/spatialspark/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

generatePartitions function in STIndex.scala

ChenZhongPu opened this issue · comments

I have several questions.

//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

objs is RDD[(Double,Double.Long)] and the third element is the index(Long).

then Wrapped(x._3/numObjectsPerSlice, x._2), x._3 should be the index(Long). Why should we build such a class,and sort by the Wrapped, which has something to do with the index(Long)?

I want to sort the data inside each slice.

BTW, if you have questions like this, not bug report or improvement suggestions. You may send me email directly rather than creating issues here :)