org.datasyslab.jts.utils.PartitioningQualityAnalysis Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of JTSplus Show documentation
Show all versions of JTSplus Show documentation
JTS Topology Suite 1.14 with additional functions for GeoSpark
package org.datasyslab.jts.utils;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import com.vividsolutions.jts.geom.Envelope;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.index.quadtree.Quadtree;
import com.vividsolutions.jts.index.strtree.GeometryItemDistance;
import com.vividsolutions.jts.index.strtree.STRtree;
public class PartitioningQualityAnalysis {
public static void main(String[] args) {
//Declare a partitioning method
//Quadtree testtree=new Quadtree();
STRtree testtree=new STRtree();
//Quadtree testtree=new Quadtree();
//This is to generate random test rectangles
Random rand = new Random();
//This is to store the entire test rectangles
List spatialobjects=new ArrayList();
//This is to store how times one spatial object has been overlapped/contained
List spatialobjectsStatus=new ArrayList();
//This is to count how many rectangles fall into each boundary
List counter=new ArrayList();
//Total number of records
int totalTestRectangles=3000;
//Sum of records per boundary
int sum=0;
//Generate test data
GeometryFactory fact = new GeometryFactory();
for(int i=0;i boundaries=testtree.queryBoundary();
System.out.println("This tree returns "+boundaries.size()+" boundaries");
//This is to print out boundaries and initialize each counter to 0
for(int i=0;i1)
{
System.out.println("Warning: Object "+i+" has been touched: "+spatialobjectsStatus.get(i));
}
}
//This is to output the counter value. You can know the data distribution in these boundaries.
for(int i=0;i
© 2015 - 2024 Weber Informatics LLC | Privacy Policy