Algorithm 1.
SparkGIS Load And Prepare Data
| 1: | procedure AsyncPrepareData(dataset) |
| 2: | binData = inputSrc.getDataAsBinaryRDD(dataset) |
| 3: | Initialize List mbbs |
| 4: | Initialize dataConfig.space |
| 5: | for each spatialObject in binData do |
| 6: | mbb = extractMBB(spatialObject) |
| 7: | /* compute space dimensions and properties */ |
| 8: | dataConfig.space.append(mbb) |
| 9: | mbbs.add(mbb) |
| 10: | end for |
| 11: | dataConfig.localIndex = mbbs.createLocalIndex () |
| 12: | /* estimates parameters for load balancing */ |
| 13: | dataConfig.estimateParams () |
| 14: | return dataConfig |
| 15: | end procedure |
| 16: | procedure Load(datasets, partitionMethod) |
| 17: | /* parallel for loop */ |
| 18: | Initialize List configs |
| 19: | for each dataset in datasets do |
| 20: | configs.add(AsyncPrepareData(dataset)) |
| 21: | end for |
| 22: | Partition dataspace in tiles using partitionMethod |
| 23: | Build global index |
| 24: | Use global index to map spatial objects to tiles |
| 25: | end procedure |