Skip to content

Problem using RangeQuery.SpatialRangeQuery #393

Description

@fmarchand

Is the RangeQuery was implemented with Polygons since #34 ?
I think yes but the two first arguments of RangeQuery.SpatialRangeQuery are either SpatialRDD xor a Geometry.

Expected behavior

I would like to use 2 SpatialRDD's partitioned with the same partitioner :

spatialRDD.analyze()
spatialRDD.spatialPartitioning(GridType.KDBTREE)

shapeRDD.spatialPartitioning(spatialRDD.getPartitioner)

And filter all points that are out of this multi-polygons shape like this :
val filteredPoints = RangeQuery.SpatialRangeQuery(spatialRDD, shapeRDD, false, false)

Actual behavior

I loaded a shapefile into a PolygonRDD like this :
val shapeRDD = ShapefileReader.readToGeometryRDD(sc, "hdfs://name-0-node.hdfs.autoip.dcos.thisdcos.directory:9001/kaggle/taxi/nyc-borough-boundaries")

I have a SpatialRDD (list of points), loaded from HDFS too that I converted from a Dataframe :

var spatialRDD = new SpatialRDD[Geometry]
spatialRDD.rawSpatialRDD = Adapter.toRdd(spatialDf)

But doing the RangeQuery.SpatialRangeQuery(spatialRDD, shapeRDD, false, false)

I get this error :

<console>:38: error: overloaded method value SpatialRangeQuery with alternatives:
  [U <: com.vividsolutions.jts.geom.Geometry, T <: com.vividsolutions.jts.geom.Geometry](x$1: U, x$2: org.datasyslab.geospark.spatialRDD.SpatialRDD[T], x$3: Boolean, x$4: Boolean)org.apache.spark.api.java.JavaRDD[T] <and>
  [U <: com.vividsolutions.jts.geom.Geometry, T <: com.vividsolutions.jts.geom.Geometry](x$1: com.vividsolutions.jts.geom.Envelope, x$2: org.datasyslab.geospark.spatialRDD.SpatialRDD[T], x$3: Boolean, x$4: Boolean)org.apache.spark.api.java.JavaRDD[T] <and>
  [U <: com.vividsolutions.jts.geom.Geometry, T <: com.vividsolutions.jts.geom.Geometry](x$1: org.datasyslab.geospark.spatialRDD.SpatialRDD[T], x$2: com.vividsolutions.jts.geom.Envelope, x$3: Boolean, x$4: Boolean)org.apache.spark.api.java.JavaRDD[T] <and>
  [U <: com.vividsolutions.jts.geom.Geometry, T <: com.vividsolutions.jts.geom.Geometry](x$1: org.datasyslab.geospark.spatialRDD.SpatialRDD[T], x$2: U, x$3: Boolean, x$4: Boolean)org.apache.spark.api.java.JavaRDD[T]
 cannot be applied to (org.datasyslab.geospark.spatialRDD.SpatialRDD[com.vividsolutions.jts.geom.Geometry], org.datasyslab.geospark.spatialRDD.SpatialRDD[com.vividsolutions.jts.geom.Geometry], Boolean, Boolean)

Which is normal because according to the signature, it waits for something that extends Geometry and not a SpatialRDD ... but I don't know then how to do my RangeQuery with the SpatialRDD given by ShapefileReader.readToGeometryRDD.

Settings

GeoSpark version = 1.2

Apache Spark version = 2.2.1

JRE version = 1.8

API type = Scala

Somebody could help me ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions