git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngineGeoSpatialExtension@76478 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
9d01b2a0fb
commit
8645e82f86
|
@ -12,10 +12,12 @@ import org.gcube.spatial.data.geonetwork.GeoNetwork;
|
||||||
import org.gcube.spatial.data.geonetwork.GeoNetworkReader;
|
import org.gcube.spatial.data.geonetwork.GeoNetworkReader;
|
||||||
import org.gcube.spatial.data.geonetwork.configuration.Configuration;
|
import org.gcube.spatial.data.geonetwork.configuration.Configuration;
|
||||||
import org.gcube.spatial.data.geonetwork.configuration.ConfigurationManager;
|
import org.gcube.spatial.data.geonetwork.configuration.ConfigurationManager;
|
||||||
|
import org.geotoolkit.metadata.iso.identification.DefaultDataIdentification;
|
||||||
import org.opengis.metadata.Metadata;
|
import org.opengis.metadata.Metadata;
|
||||||
import org.opengis.metadata.citation.OnlineResource;
|
import org.opengis.metadata.citation.OnlineResource;
|
||||||
import org.opengis.metadata.distribution.DigitalTransferOptions;
|
import org.opengis.metadata.distribution.DigitalTransferOptions;
|
||||||
import org.opengis.metadata.identification.Identification;
|
import org.opengis.metadata.identification.Identification;
|
||||||
|
import org.opengis.metadata.identification.Resolution;
|
||||||
|
|
||||||
public class FeaturesManager {
|
public class FeaturesManager {
|
||||||
// private String geonetworkUrl = "http://geoserver-dev2.d4science-ii.research-infrastructures.eu/geonetwork/";
|
// private String geonetworkUrl = "http://geoserver-dev2.d4science-ii.research-infrastructures.eu/geonetwork/";
|
||||||
|
@ -31,7 +33,32 @@ public class FeaturesManager {
|
||||||
public void setScope(String scope) {
|
public void setScope(String scope) {
|
||||||
this.scope = scope;
|
this.scope = scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static double getResolution(Metadata meta){
|
||||||
|
double res = 0;
|
||||||
|
try{
|
||||||
|
DefaultDataIdentification ddi = (DefaultDataIdentification) meta.getIdentificationInfo().iterator().next();
|
||||||
|
//take the lowest resolution
|
||||||
|
for (Resolution r:ddi.getSpatialResolutions()){
|
||||||
|
Double rr = r.getDistance();
|
||||||
|
if (rr ==null)
|
||||||
|
rr=r.getEquivalentScale().doubleValue();
|
||||||
|
|
||||||
|
if (rr!=null && rr>res){
|
||||||
|
res = rr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch(Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
AnalysisLogger.getLogger().debug("Could not get Data Identification");
|
||||||
|
}
|
||||||
|
|
||||||
|
AnalysisLogger.getLogger().debug("Calculated Resolution is:"+res);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getGeoserverLink(Metadata meta) {
|
public String getGeoserverLink(Metadata meta) {
|
||||||
String link = null;
|
String link = null;
|
||||||
String geoserverString = "/geoserver/";
|
String geoserverString = "/geoserver/";
|
||||||
|
@ -82,7 +109,8 @@ public class FeaturesManager {
|
||||||
System.out.println("NO ONLINE LINK WAS FOUND ACCORDING TO THE CRITERION :" + criterion);
|
System.out.println("NO ONLINE LINK WAS FOUND ACCORDING TO THE CRITERION :" + criterion);
|
||||||
return link;
|
return link;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private String searchLayerNameInMeta(Metadata meta) {
|
private String searchLayerNameInMeta(Metadata meta) {
|
||||||
String innerlayername = null;
|
String innerlayername = null;
|
||||||
for (DigitalTransferOptions option : meta.getDistributionInfo().getTransferOptions()) {
|
for (DigitalTransferOptions option : meta.getDistributionInfo().getTransferOptions()) {
|
||||||
|
@ -356,13 +384,14 @@ public class FeaturesManager {
|
||||||
this.geonetworkPwd = geonetworkPwd;
|
this.geonetworkPwd = geonetworkPwd;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String treatTitleForGN(String layerTitle) {
|
public static String treatTitleForGN(String origLayerTitle) {
|
||||||
int idx = layerTitle.indexOf(" from ");
|
String layerTitle = origLayerTitle.toLowerCase();
|
||||||
|
int idx = layerTitle.indexOf(" from [");
|
||||||
String layerTitle2 = layerTitle;
|
String layerTitle2 = layerTitle;
|
||||||
if (idx>0)
|
if (idx>0)
|
||||||
layerTitle2 = layerTitle.toLowerCase().substring(0, idx).trim();
|
layerTitle2 = layerTitle.toLowerCase().substring(0, idx).trim();
|
||||||
else {
|
else {
|
||||||
idx = layerTitle.indexOf(" in ");
|
idx = layerTitle.indexOf(" in [");
|
||||||
if (idx>0)
|
if (idx>0)
|
||||||
layerTitle2 = layerTitle.toLowerCase().substring(0, idx).trim();
|
layerTitle2 = layerTitle.toLowerCase().substring(0, idx).trim();
|
||||||
else{
|
else{
|
||||||
|
|
Loading…
Reference in New Issue