Open zdila opened 1 year ago
@zdila in Apache Sedona (https://github.com/apache/sedona), we have been dealing with this issue for a while and I contributed a few functions to JTS to make the clone
possible (in Sedona, we call it Serialize/Deserialize): https://github.com/locationtech/jts/pull/634 The necessary building blocks in JTS are package-private so it seems to be impossible to implement but it is actually possible.
Please feel free to use our Sedona serializer to clone STRtree and QuadTree.
Implementation: https://github.com/apache/sedona/tree/master/common/src/main/java/org/locationtech/jts/index Coding example: https://github.com/apache/sedona/blob/master/common/src/test/java/org/apache/sedona/common/geometrySerde/SpatialIndexSerdeTest.java#L83
To use it, add the following dependencies in addition to your JTS dependency
<!-- https://mvnrepository.com/artifact/org.apache.sedona/sedona-common -->
<dependency>
<groupId>org.apache.sedona</groupId>
<artifactId>sedona-common</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>com.esotericsoftware</groupId>
<artifactId>kryo</artifactId>
<version>4.0.2</version>
</dependency>
We need a mean to "clone" existing
STRTree
to another one. Cloning should not build any of the source or destinationSTRTree
.This could be suitable also for other
SpatialIndex
es.