JedAI-spatial is an open-source system for computing topological relations according to the DE9IM model between datasets with geometric entities. It consists of three modules:
- The serial one, which runs on a single CPU with Java 8 or later
- The parallel one, based on Scala 2.11.12 and Apache Spark 2.4.4
- The GUI
We describe each module in more detail in the following.
For more details, please refer to the technical report Three-dimensional Geospatial Interlinking with JedAI-spatial).
This component comprises the state-of-the-art methods for Geospatial Interlinking in the literature.
All methods implement the Filtering-Verification framework, which consists of two consequtive steps:
- Filtering
- Verification
The Filtering step generates a set of candidate pairs, based on the minimum bounding rectangle (MBR) of each geometry.
The Verification step examines every candidate pair as long as the MBRs of its constituent geometries are intersecting. The detected topological relations are added to the output set of triples.
Based on the type of the index used in Filtering, JedAI-spatial organizes the available algorithms into three categories:
- Grid-based algorithms build an Equigrid by dividing the Earth’s surface into cells (a.k.a. tiles) of the same dimensions. Every geometry is placed into the tiles that intersect its MBR.
- Partition-based algorithms sort all input geometries in ascending order of their lower boundary on the horizontal axis and move a sweepline across the Earth’s surface. Geometry pairs whose MBRs simultaneously intersect the sweep line are verified.
- Tree-based Algorithms build a tree index for the source geometries and for each target geometry verify the candidates in the leaf nodes with intersecting MBRs.
In more detail, the following algorithms are implemented per category:
- RADON
- Filtering: Loads both datasets into main memory and indexes all geometries.
- Verification: Computes the Intersection Matrix for all candidate pairs.
- Static RADON
- Same as RADON, but the size of the Equigrid is determined by the user.
- GIA.nt
- Filtering: Loads only the input dataset with the fewer geometries into main memory.
- Verification: Reads input geometries of the other dataset from disk and computes the Intersection Matrix.
- Static GIA.nt
- Same as GIA.nt, but the size of the Equigrid is determined by the user.
- Plane Sweep
- Applies the approach of partition-based algorithms to all input geometries.
- PBSM
- Splits the geometries into manually defined partitions and applies Plane Sweep on each one.
- Stripe Sweep
- The Filtering step sorts only the source geometries.
- The Verification step probes every target geometry against the stripes and aggregates the set of the source geometries that intersect the same stripes with the target ones.
The scalability experiments were performed using this class.
This component comprises parallel methods from famous spatial processing systems in the literature
- Scala 2.11.12
- Apache Spark 2.4.4
In order to run an experiment on the cluster, one has to first build a fat jar (Java Archive) file using the command sbt assembly
and provide the configuration for the execution according to the configuration file at config/configurationTemplate.yaml
.
Process:
$ sbt assembly
$ spark-submit --master <master> --class experiments.<ParallelMethodExperiment> target/scala-2.11/DS-JedAI-assembly-0.1.jar <options> -conf </path/to/configuration.yaml>
The available <ParallelMethodExperiment>
are:
GeoSparkExp
SedonaExp
SpatialSparkPartitionedExp
SpatialSparkExp
LocationSparkExp
MagellanExp
Each parallel implementation is divided in three consecutive phases:
- Preprocessing Stage
- Global Join Stage
- Local Join Stage
The Preprocessing Stage prepares the data for the main processing phases. First of all, the source and target datasets are read from the HDFS in order to be transformed into RDDs. Then, they are split into logical/physical partitions based on a partitioning method. This is a classic technique in Apache Spark. Remember that it is a distributed framework running on a cluster. The main idea is to group the data into partitions so as to reduce the Spark shuffles and hence increase the performance. A Spark shuffle is when data is rearranged between partitions.
In more detail, each framework uses its own set of partitioning techniques, such as Quad Trees or Z-Order Curves, in order to partition the source data. Then, the geometries of both source and target RDD datasets are assigned an identifier based on the partitions they lie in space. The RDD is shaped as <K,V>
where K is the identifier of the partition and V the geometry. In case a geometry belongs to multiple partitions, it is assigned multiple identifiers, i.e. <K1,V>
, <K2,V>
.
In the Global Join Stage, the source and target RDDs are joined in the same partitions based on their key K, the partition identifier. Each partition is a processing unit in the cluster. The joined RDD is shaped as <K,V>
, with V changing to a tuple of (Iterable[SourceGeometries], Iterable[TargetGeometries])
.
The third and final phase, Local Join Stage, performs the spatial join on the candidate geometries within the same partition. Two are the available techniques, each having two steps:
-
Nested Loop Index Join:
- Filtering Step: Identifies all intersecting MBRs between target and source candidates using a Spatial Index built from the
Iterable[SourceGeometries]
. - Verification Step: Verify the topological relations of each pair of source-target candidates.
- Filtering Step: Identifies all intersecting MBRs between target and source candidates using a Spatial Index built from the
-
Nested Loop Join:
- Filtering Step: Filter all the intersecting MBRs between target and source candidates by comparing each target from
Iterable[TargetGeometries]
with each source geometry fromIterable[SourceGeometries]
. - Verification Step: Verify the topological relations of each pair of source-target candidates.
- Filtering Step: Filter all the intersecting MBRs between target and source candidates by comparing each target from
Spatial Spark has two implementations, a Partitioned Join (process afore-mentioned) and a Broadcast Join. The Broadcast Join leverages the Apache Spark's broadcast variables, however it is not useful for big datasets due to KryoSerializer's 2GB maximum buffer value.
For the experiments on the paper, we solely used the Partitioned Join variant. It supports 3 partitioning techniques (Binary Tree, Fixed Grid and STR partitioning) and Nested Loop Local Join.
Hereby, we present sample configuration files for each method, which we used in our experiments for the D1 dataset:
source:
path: "hdfs:///<path>/AREAWATER.tsv"
realIdField: "2"
geometryField: "0"
target:
path: "hdfs:///<path>/LINEARWATER.tsv"
realIdField: "2"
geometryField: "0"
relation: "DE9IM"
configurations:
partitions: "400"
spatialSparkMethod: "FGP"
spatialSparkMethodConf: "512:512"
Apache Sedona supports two partitioning techniques (KDB-Tree and Quad-Tree) and both a Nested Loop Join and a Nested Loop Index Join (R-Tree and QuadTree).
Bear in mind, JedAI-spatial has integrated GeoSpark as well.
Hereby, we present sample configuration files for each method, which we used in our experiments for the D1 dataset:
source:
path: "hdfs:///<path>/AREAWATER.tsv"
realIdField: "2"
geometryField: "0"
target:
path: "hdfs:///<path>/LINEARWATER.tsv"
realIdField: "2"
geometryField: "0"
relation: "DE9IM"
configurations:
sedonaGridType: "KDBTREE"
sedonaLocalIndexType: "RTREE"
partitions: "400"
Location Spark is the only spatial frameworks that uses a form of Skew Analysis. It supports three partitioning techniques(EqualGrid and QuaTree) and a Nested Loop Index Join (R-Tree, EqualGrid, QuadTree).
Hereby, we present sample configuration files for each method, which we used in our experiments for the D1 dataset:
source:
path: "hdfs:///<path>/AREAWATER.tsv"
realIdField: "2"
geometryField: "0"
target:
path: "hdfs:///<path>/LINEARWATER.tsv"
realIdField: "2"
geometryField: "0"
relation: "DE9IM"
configurations:
locationSparkLocalIndexType: "QUADTREE"
partitions: "400"
Magellan utilizes Z-Order Curves for partitioning the data and a Nested Loop Join for spatial join.
Hereby, we present sample configuration files for each method, which we used in our experiments for the D1 dataset:
source:
path: "hdfs:///<path>/AREAWATER.tsv"
realIdField: "2"
geometryField: "0"
target:
path: "hdfs:///<path>/LINEARWATER.tsv"
realIdField: "2"
geometryField: "0"
relation: "DE9IM"
configurations:
partitions: "400"
magellanZOrderCurvePrecision: "20"
- S. You, J. Zhang, and L. Gruenwald, “Large-scale spatial join query processing in Cloud,” in 2015 31st IEEE International Conference on Data Engineering Workshops, 2015.
- https://github.com/syoummer/SpatialSpark
- J. Yu, Z. Zhang, and M. Sarwat, “Spatial data management in apache spark: the GeoSpark perspective and beyond,” Geoinformatica, vol. 23, no. 1, pp. 37–78, 2019.
- J. Yu, J. Wu, and M. Sarwat, “GeoSpark: A cluster computing framework for processing large-scale spatial data,” in Proceedings of the 23rd SIGSPATIAL International Conference on Advances in Geographic Information Systems - GIS ’15, 2015.
- https://sedona.apache.org/
- M. Tang, Y. Yu, Q. M. Malluhi, M. Ouzzani, and W. G. Aref, “LocationSpark: A distributed in-memory data management system for big spatial data,” Proceedings VLDB Endowment, vol. 9, no. 13, pp. 1565–1568, 2016.
- M. Tang, Y. Yu, A. R. Mahmood, Q. M. Malluhi, M. Ouzzani, and W. G. Aref, “LocationSpark: In-memory distributed spatial query processing and optimization,” Front. Big Data, vol. 3, p. 30, 2020.
- https://github.com/purduedb/LocationSpark
- https://github.com/harsha2010/magellan
All real-world datasets that are used in the experimental analysis of JedAI-spatial are publicly available here.
- 1D Linestrings/Polylines
- 2D Polygons
The Docker file for JedAI-spatial Web application is available here, whereas the public repository in Docker Hub is here.
There are two ways to create the docker image.
docker pull gpapadis84/jedaispatial
git clone https://github.com/AI-team-UoA/JedAI-spatial.git
sudo docker build -t gpapadis84/jedaispatial JedAI-spatial
In both cases, the Docker container can be run with the following command:
sudo docker run -e JAVAOPTIONS=‘-Xmx4g’ -p 8080:8080 gpapadis84/jedaispatial
To compile and run JedAI-spatial serial:
-
Change to the directory that serial source code resides in
cd serial
-
Build JedAI-spatial serial using maven
mvn clean package
-
Execute the program through the CLI class
java -cp target/geospatialinterlinking-1.0-SNAPSHOT-jar-with-dependencies.jar workflowManager.CommandLineInterface
-
Through the CLI select input and target files, execution method and wether to export results or not
-
If the choice to export the results was selected, the output file will be a NTRIPLES file of the following format:
<0> <http://www.opengis.net/ont/geosparql#sfContains> <1> .
<0> <http://www.opengis.net/ont/geosparql#sfCoverdBy> <1> .
<0> <http://www.opengis.net/ont/geosparql#sfCovers> <1> .
<0> <http://www.opengis.net/ont/geosparql#sfEquals> <1> .
<0> <http://www.opengis.net/ont/geosparql#sfIntersects> <1> .
<0> <http://www.opengis.net/ont/geosparql#sfWithin> <1> .
<1> <http://www.opengis.net/ont/geosparql#sfContains> <2> .
<1> <http://www.opengis.net/ont/geosparql#sfCoverdBy> <2> .
<1> <http://www.opengis.net/ont/geosparql#sfCovers> <2> .
<1> <http://www.opengis.net/ont/geosparql#sfEquals> <2> .
<1> <http://www.opengis.net/ont/geosparql#sfIntersects> <2> .
<1> <http://www.opengis.net/ont/geosparql#sfWithin> <2> .
<2> <http://www.opengis.net/ont/geosparql#sfContains> <3> .
<2> <http://www.opengis.net/ont/geosparql#sfCoverdBy> <3> .
<2> <http://www.opengis.net/ont/geosparql#sfCovers> <3> .
<2> <http://www.opengis.net/ont/geosparql#sfEquals> <3> .
<2> <http://www.opengis.net/ont/geosparql#sfIntersects> <3> .
...
In this (Subject, Predicate, Object) triples represent:
-Subject: the id of a geometry from the source file. The id given to each entity is related to its position in the source file. Ids from the source file start from 0. The first entity in the source file will have an id <0>, the second <1> etc.
-Predicate: the discovered relation between subject and object.
-Object: the id of a geometry from the target file. The id given to each entity is related to its position in the target file. Ids from the target file start from 1. The first entity in the source file will have an id <1>, the second <2> etc.
- The ids from source and target files are different even when the source and target files are the same. Source files always start with ids from 0, while target files always start with ids from 1.
- When operation on TSV files the serial version of JedAI-Spatial may get stuck and stop functioning. Please use the CSV counterparts of the input files instead.
- The JedAI-Spatial GUI will be extended so that it can export the results.