Skip to content

Querying a Tile Layer Results in a RDD That Contains Duplicate Values #2140

Closed

Description

@jbouffard

When doing a spatial query on a saptial layer, the resulting RDD contains duplicate values of the intersecting tiles.

import geotrellis.vector._
import geotrellis.raster._
import geotrellis.spark._
import geotrellis.spark.io._
import geotrellis.spark.io.file._

import org.apache.spark._
val poly = Polygon(Point(8348915.4669, 543988.943201519), Point(8348915.4669, 543988.94320152), Point(8348915.46680623, 543988.94320152), Point(8348915.46680623, 543988.943201519), Point(8348915.4669, 543988.943201519))

val conf = new SparkConf().setAppName("test").setMaster("local[*]")
implicit val sc = new SparkContext(conf)

val fa = new FileAttributeStore("../geopyspark/geopyspark/tests/data_files/geotiff_test_files/catalog")
val layerReader = FileLayerReader(fa)

val id = LayerId("catalog-test", 11)
val layer = layerReader.query[SpatialKey, MultibandTile, TileLayerMetadata[SpatialKey]](id)
val query = layer.where(Intersects(poly))

query.result.map(x => x._1).foreach(println)
17/04/17 14:01:19 INFO SparkContext: Starting job: foreach at <console>:38
17/04/17 14:01:19 INFO DAGScheduler: Got job 3 (foreach at <console>:38) with 4 output partitions
17/04/17 14:01:19 INFO DAGScheduler: Final stage: ResultStage 3 (foreach at <console>:38)
17/04/17 14:01:19 INFO DAGScheduler: Parents of final stage: List()
17/04/17 14:01:19 INFO DAGScheduler: Missing parents: List()
17/04/17 14:01:19 INFO DAGScheduler: Submitting ResultStage 3 (MapPartitionsRDD[17] at map at <console>:38), which has no missing parents
17/04/17 14:01:19 INFO MemoryStore: Block broadcast_3 stored as values in memory (estimated size 17.5 KB, free 912.2 MB)
17/04/17 14:01:19 INFO MemoryStore: Block broadcast_3_piece0 stored as bytes in memory (estimated size 7.6 KB, free 912.2 MB)
17/04/17 14:01:19 INFO BlockManagerInfo: Added broadcast_3_piece0 in memory on 172.17.0.1:42704 (size: 7.6 KB, free: 912.3 MB)
17/04/17 14:01:19 INFO SparkContext: Created broadcast 3 from broadcast at DAGScheduler.scala:996
17/04/17 14:01:19 INFO DAGScheduler: Submitting 4 missing tasks from ResultStage 3 (MapPartitionsRDD[17] at map at <console>:38)
17/04/17 14:01:19 INFO TaskSchedulerImpl: Adding task set 3.0 with 4 tasks
17/04/17 14:01:19 INFO TaskSetManager: Starting task 0.0 in stage 3.0 (TID 12, localhost, executor driver, partition 0, PROCESS_LOCAL, 6216 bytes)
17/04/17 14:01:19 INFO TaskSetManager: Starting task 1.0 in stage 3.0 (TID 13, localhost, executor driver, partition 1, PROCESS_LOCAL, 6090 bytes)
17/04/17 14:01:19 INFO TaskSetManager: Starting task 2.0 in stage 3.0 (TID 14, localhost, executor driver, partition 2, PROCESS_LOCAL, 6090 bytes)
17/04/17 14:01:19 INFO TaskSetManager: Starting task 3.0 in stage 3.0 (TID 15, localhost, executor driver, partition 3, PROCESS_LOCAL, 6090 bytes)
17/04/17 14:01:19 INFO Executor: Running task 1.0 in stage 3.0 (TID 13)
17/04/17 14:01:19 INFO Executor: Running task 0.0 in stage 3.0 (TID 12)
17/04/17 14:01:19 INFO Executor: Running task 2.0 in stage 3.0 (TID 14)
17/04/17 14:01:19 INFO Executor: Running task 3.0 in stage 3.0 (TID 15)
SpatialKey(1450,996) // result one
SpatialKey(1450,996) // result two
17/04/17 14:01:19 INFO Executor: Finished task 3.0 in stage 3.0 (TID 15). 925 bytes result sent to driver
17/04/17 14:01:19 INFO Executor: Finished task 0.0 in stage 3.0 (TID 12). 925 bytes result sent to driver
17/04/17 14:01:19 INFO TaskSetManager: Finished task 3.0 in stage 3.0 (TID 15) in 78 ms on localhost (executor driver) (1/4)
17/04/17 14:01:19 INFO TaskSetManager: Finished task 0.0 in stage 3.0 (TID 12) in 90 ms on localhost (executor driver) (2/4)
SpatialKey(1450,996) // result three
17/04/17 14:01:19 INFO Executor: Finished task 1.0 in stage 3.0 (TID 13). 925 bytes result sent to driver
SpatialKey(1450,996) // result 4
17/04/17 14:01:19 INFO TaskSetManager: Finished task 1.0 in stage 3.0 (TID 13) in 97 ms on localhost (executor driver) (3/4)
17/04/17 14:01:19 INFO Executor: Finished task 2.0 in stage 3.0 (TID 14). 925 bytes result sent to driver
17/04/17 14:01:19 INFO TaskSetManager: Finished task 2.0 in stage 3.0 (TID 14) in 94 ms on localhost (executor driver) (4/4)
17/04/17 14:01:19 INFO TaskSchedulerImpl: Removed TaskSet 3.0, whose tasks have all completed, from pool 
17/04/17 14:01:19 INFO DAGScheduler: ResultStage 3 (foreach at <console>:38) finished in 0.099 s
17/04/17 14:01:19 INFO DAGScheduler: Job 3 finished: foreach at <console>:38, took 0.116683 s

Activity

  1. lossyrob commented on Apr 30, 2017

    @lossyrob
    Member

    @jbouffard is this a GeoTrellis problem or a geopyspark problem? Can you give duplication steps that shows the problem exists in pure GeoTrellis (e.g. with these files, do a file layer ingest, read the code like this, and see the issue).

  2. added this to the 1.2 milestone on Apr 30, 2017
  3. fosskers commented on May 1, 2017

    @fosskers
    Contributor

    I found this as well on Friday when querying VT layers. My tile set had four "bins", but only 61 actual tiles. Querying the entire layer gave 244 tiles (61 * 4 = 244).

    For the record, it was the FileLayerReader I used.

  4. lossyrob commented on May 1, 2017

    @lossyrob
    Member

    Can you give scoped replication steps @fosskers?

  5. fosskers commented on May 1, 2017

    @fosskers
    Contributor

    Steps:

    • Publish local a GeoTrellis off this branch
    • Publish local VectorPipe off this branch
    • Clone vectorpipe-io and tweak it to use a path on your FS + some data I can give you (don't start with Vancouver, use something else). Run with sbt run.
    • Clone vectortile-simplify and tweak it to read the Layer you wrote with vectorpipe-io. Notice this line
    • Remove the mentioned line and sbt run it. Do a count somewhere and notice 244 tiles are read.
  6. modified the milestones: 1.1, 1.2 on May 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions