39 lines
1.1 KiB
Java
39 lines
1.1 KiB
Java
package org.gcube.dataanalysis.geo.utils;
|
|
|
|
public class CSquareCodesConverter {
|
|
|
|
|
|
public static String convertHalfDegree(double x, double y){
|
|
|
|
if (x ==0)
|
|
x = 0.25;
|
|
if (y ==0)
|
|
y = 0.25;
|
|
|
|
String csquare = it.cnr.aquamaps.CSquare.centroidToCode(x,y, 0.5);
|
|
return csquare;
|
|
}
|
|
|
|
|
|
public static String convertAtResolution(double x, double y, double resolution){
|
|
if (resolution==0)
|
|
resolution=0.1;
|
|
if (x ==0)
|
|
x = resolution;
|
|
if (y ==0)
|
|
y = resolution;
|
|
|
|
String csquare = it.cnr.aquamaps.CSquare.centroidToCode(x,y, resolution);
|
|
return csquare;
|
|
}
|
|
|
|
public static void main(String[] args){
|
|
//System.out.println(it.cnr.aquamaps.CSquare.centroidToCode(0.5,0.5, 0.0001));
|
|
// System.out.println(it.cnr.aquamaps.CSquare.centroidToCode(-49.99999999999994,35.75000000000006, 1));
|
|
// System.out.println(it.cnr.aquamaps.CSquare.centroidToCode(35.75000000000006,-49.99999999999994, 0.5));
|
|
// System.out.println(it.cnr.aquamaps.CSquare.centroidToCode(35.75,-50, 0.5));
|
|
System.out.println(it.cnr.aquamaps.CSquare.centroidToCode(35.7500,-49.9999, 0.5));
|
|
|
|
}
|
|
}
|