AriadnePlus/dnet-ariadneplus-graphdb-pu.../test/java/eu/dnetlib/ariadneplus/elasticsearch/BulkUploadTest.java

44 lines
1.5 KiB
Java

package eu.dnetlib.ariadneplus.elasticsearch;
import org.elasticsearch.common.geo.GeoPoint;
import org.junit.Before;
import org.junit.Test;
public class BulkUploadTest {
private BulkUpload bu;
@Before
public void setup(){
bu = new BulkUpload();
}
@Test
public void testCalculateCentroidPoint(){
String wkt = "POINT (30 10)";
GeoPoint centroid = bu.calculateCentroid(wkt);
System.out.println("Long: "+centroid.getLon()+", Lat: "+centroid.getLat());
}
@Test
public void testCalculateCentroidMultiPolygon(){
String wkt = "MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)),((20 35, 10 30, 10 10, 30 5, 45 20, 20 35),(30 20, 20 15, 20 25, 30 20)))";
GeoPoint centroid = bu.calculateCentroid(wkt);
System.out.println("Long: "+centroid.getLon()+", Lat: "+centroid.getLat());
}
@Test
public void testCalculateCentroidPolygon(){
String wkt = "POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))";
GeoPoint centroid = bu.calculateCentroid(wkt);
System.out.println("Long: "+centroid.getLon()+", Lat: "+centroid.getLat());
}
@Test
public void testCalculateCentroidBB(){
String wkt = "polygon ((-1.42173131195844 51.778172135497, -1.42173131195844 51.7692537152273, -1.40712262768071 51.7692537152273, -1.40712262768071 51.778172135497, -1.42173131195844 51.778172135497))";
GeoPoint centroid = bu.calculateCentroid(wkt);
System.out.println("Long: "+centroid.getLon()+", Lat: "+centroid.getLat());
}
}