org.datasyslab.geospark.spatialPartitioning.EqualPartitioning Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of geospark Show documentation
Show all versions of geospark Show documentation
Geospatial extension for Apache Spark
/**
* FILE: EqualPartitioning.java
* PATH: org.datasyslab.geospark.spatialPartitioning.EqualPartitioning.java
* Copyright (c) 2017 Arizona State University Data Systems Lab
* All rights reserved.
*/
package org.datasyslab.geospark.spatialPartitioning;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import com.vividsolutions.jts.geom.Envelope;
// TODO: Auto-generated Javadoc
/**
* The Class EqualPartitioning.
*/
public class EqualPartitioning implements Serializable{
/** The grids. */
List grids=new ArrayList();
/**
* Instantiates a new equal partitioning.
*
* @param boundary the boundary
* @param partitions the partitions
*/
public EqualPartitioning(Envelope boundary,int partitions)
{
//Local variable should be declared here
Double root=Math.sqrt(partitions);
int partitionsAxis;
double intervalX;
double intervalY;
//Calculate how many bounds should be on each axis
partitionsAxis=root.intValue();
intervalX=(boundary.getMaxX()-boundary.getMinX())/partitionsAxis;
intervalY=(boundary.getMaxY()-boundary.getMinY())/partitionsAxis;
//System.out.println("Boundary: "+boundary+"root: "+root+" interval: "+intervalX+","+intervalY);
for(int i=0;i getGrids() {
return this.grids;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy