Added WFS cross filtering results
This commit is contained in:
parent
dcca1afba1
commit
36bfcd2b9e
|
@ -8,6 +8,7 @@ import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerCon
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent.LAYER_TYPE;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent.LAYER_TYPE;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.SwapLayer;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.SwapLayer;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.WFSMakerUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||||
|
|
||||||
|
@ -78,6 +79,8 @@ import ol.style.Style;
|
||||||
*/
|
*/
|
||||||
public abstract class OpenLayerMap {
|
public abstract class OpenLayerMap {
|
||||||
|
|
||||||
|
public static final String CQL_FILTER_PARAMETER = WFSMakerUtil.CQL_FILTER_PARAMETER;
|
||||||
|
|
||||||
private static final int MAX_LENGHT_CQL_FOR_GET_REQUEST = 1600; // 1600 characters
|
private static final int MAX_LENGHT_CQL_FOR_GET_REQUEST = 1600; // 1600 characters
|
||||||
|
|
||||||
public static final int SET_CENTER_ANIMATED_DURATION = 500;
|
public static final int SET_CENTER_ANIMATED_DURATION = 500;
|
||||||
|
@ -419,8 +422,6 @@ public abstract class OpenLayerMap {
|
||||||
if (layer == null) {
|
if (layer == null) {
|
||||||
ImageWmsParams imageWMSParams = OLFactory.createOptions();
|
ImageWmsParams imageWMSParams = OLFactory.createOptions();
|
||||||
imageWMSParams.setLayers(layerItem.getName());
|
imageWMSParams.setLayers(layerItem.getName());
|
||||||
// imageWMSParams.set("CQL_FILTER", "product_id
|
|
||||||
// IN('6165b07202ad3d60e1d26f42','6166ff8002ad3d60e1d26fb7')");
|
|
||||||
|
|
||||||
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
|
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
|
||||||
imageWMSOptions.setUrl(layerItem.getMapServerHost());
|
imageWMSOptions.setUrl(layerItem.getMapServerHost());
|
||||||
|
@ -478,9 +479,9 @@ public abstract class OpenLayerMap {
|
||||||
ImageWmsParams imageWMSParams = imageWMSSource.getParams();
|
ImageWmsParams imageWMSParams = imageWMSSource.getParams();
|
||||||
|
|
||||||
if (cqlFilterExpression == null || cqlFilterExpression.length() > MAX_LENGHT_CQL_FOR_GET_REQUEST) {
|
if (cqlFilterExpression == null || cqlFilterExpression.length() > MAX_LENGHT_CQL_FOR_GET_REQUEST) {
|
||||||
imageWMSParams.delete("CQL_FILTER");
|
imageWMSParams.delete(CQL_FILTER_PARAMETER);
|
||||||
} else {
|
} else {
|
||||||
imageWMSParams.set("CQL_FILTER", cqlFilterExpression);
|
imageWMSParams.set(CQL_FILTER_PARAMETER, cqlFilterExpression);
|
||||||
}
|
}
|
||||||
|
|
||||||
imageWMSSource.updateParams(imageWMSParams);
|
imageWMSSource.updateParams(imageWMSParams);
|
||||||
|
|
|
@ -8,13 +8,19 @@ import java.util.List;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.GroupedLayersDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.GroupedLayersDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.layers.CrossFilteringLayerDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.layers.CrossFilteringLayerDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.layers.LayerIDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.layers.LayerIDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDILayer;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ApplyCQLToLayerMapEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ApplyCQLToLayerMapEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.OLGeoJSONUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.OLGeoJSONUtil;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.WFSMakerUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.Alert;
|
||||||
import com.github.gwtbootstrap.client.ui.Button;
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
import com.github.gwtbootstrap.client.ui.CheckBox;
|
import com.github.gwtbootstrap.client.ui.CheckBox;
|
||||||
import com.github.gwtbootstrap.client.ui.ControlGroup;
|
import com.github.gwtbootstrap.client.ui.ControlGroup;
|
||||||
|
@ -23,6 +29,7 @@ import com.github.gwtbootstrap.client.ui.Controls;
|
||||||
import com.github.gwtbootstrap.client.ui.DropdownButton;
|
import com.github.gwtbootstrap.client.ui.DropdownButton;
|
||||||
import com.github.gwtbootstrap.client.ui.Fieldset;
|
import com.github.gwtbootstrap.client.ui.Fieldset;
|
||||||
import com.github.gwtbootstrap.client.ui.ListBox;
|
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||||
|
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.event.dom.client.ChangeEvent;
|
import com.google.gwt.event.dom.client.ChangeEvent;
|
||||||
|
@ -39,6 +46,8 @@ import com.google.gwt.http.client.URL;
|
||||||
import com.google.gwt.uibinder.client.UiBinder;
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
import com.google.gwt.uibinder.client.UiField;
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
|
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
import jsinterop.base.JsPropertyMap;
|
import jsinterop.base.JsPropertyMap;
|
||||||
|
@ -61,6 +70,9 @@ public class CrossFilteringLayerPanel extends Composite {
|
||||||
@UiField
|
@UiField
|
||||||
Fieldset fieldSet;
|
Fieldset fieldSet;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
HTMLPanel panelResults;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
Button buttonReset;
|
Button buttonReset;
|
||||||
|
|
||||||
|
@ -138,6 +150,7 @@ public class CrossFilteringLayerPanel extends Composite {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
|
panelResults.clear();
|
||||||
for (int i = 1; i < mapInnestedListBoxes.size(); i++) {
|
for (int i = 1; i < mapInnestedListBoxes.size(); i++) {
|
||||||
resetListBoxLevel(i);
|
resetListBoxLevel(i);
|
||||||
}
|
}
|
||||||
|
@ -201,7 +214,7 @@ public class CrossFilteringLayerPanel extends Composite {
|
||||||
if (selectedItem != null) {
|
if (selectedItem != null) {
|
||||||
|
|
||||||
String cqlFilterValue = crossFilteringLayer.getTable_parent_key_field() + "=" + selectedItem.keyValue;
|
String cqlFilterValue = crossFilteringLayer.getTable_parent_key_field() + "=" + selectedItem.keyValue;
|
||||||
wfsURL += "&CQL_FILTER=" + URL.encode(cqlFilterValue);
|
wfsURL += "&" + WFSMakerUtil.CQL_FILTER_PARAMETER + "=" + URL.encode(cqlFilterValue);
|
||||||
|
|
||||||
}
|
}
|
||||||
GWT.log("wfsURL request: " + wfsURL);
|
GWT.log("wfsURL request: " + wfsURL);
|
||||||
|
@ -401,12 +414,87 @@ public class CrossFilteringLayerPanel extends Composite {
|
||||||
private void buildCrossFilteringCQLAndFireEvent(SelectableItem selectableItem) {
|
private void buildCrossFilteringCQLAndFireEvent(SelectableItem selectableItem) {
|
||||||
String setCqlFilter = "INTERSECTS(geom,querySingle('" + selectableItem.layername + "','"
|
String setCqlFilter = "INTERSECTS(geom,querySingle('" + selectableItem.layername + "','"
|
||||||
+ selectableItem.theGeometryName + "','" + selectableItem.keyField + "=''" + selectableItem.keyValue
|
+ selectableItem.theGeometryName + "','" + selectableItem.keyField + "=''" + selectableItem.keyValue
|
||||||
+ "'''));INCLUDE";
|
+ "'''))";
|
||||||
|
// setCqlFilter = URL.encode(setCqlFilter);
|
||||||
GWT.log("CQL FILTER built: " + setCqlFilter);
|
GWT.log("CQL FILTER built: " + setCqlFilter);
|
||||||
|
|
||||||
// olMapMng.getOLMap().setCQLFilterToWMSLayer(layerName, setCqlFilter);
|
IndexLayerDV indexLayer = gCubeCollection.getIndexes().get(0);
|
||||||
|
applicationBus.fireEvent(new ApplyCQLToLayerMapEvent(indexLayer, setCqlFilter));
|
||||||
|
|
||||||
applicationBus.fireEvent(new ApplyCQLToLayerMapEvent(gCubeCollection.getIndexes().get(0), setCqlFilter));
|
try {
|
||||||
|
GCubeSDILayer layer = indexLayer.getLayer();
|
||||||
|
String wmsLink = layer.getOgcLinks().get("wms");
|
||||||
|
String layerName = URLUtil.extractValueOfParameterFromURL("layers", wmsLink);
|
||||||
|
String serviceURL = URLUtil.getPathURL(wmsLink);
|
||||||
|
String toLServiceURL = serviceURL.toLowerCase();
|
||||||
|
if (toLServiceURL.endsWith("wms")) {
|
||||||
|
toLServiceURL = toLServiceURL.substring(0, toLServiceURL.length() - 3) + "ows";
|
||||||
|
}
|
||||||
|
String wfsCrossFilteringQuery = WFSMakerUtil.buildWFSRequest(toLServiceURL, layerName, 1000, "geom",
|
||||||
|
setCqlFilter);
|
||||||
|
GWT.log("wfsCrossFilteringQuery: " + wfsCrossFilteringQuery);
|
||||||
|
showCountResultsOfWFSCrossFiltering(wfsCrossFilteringQuery);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO: handle exception
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showCountResultsOfWFSCrossFiltering(String wfsQuery) {
|
||||||
|
|
||||||
|
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, wfsQuery);
|
||||||
|
panelResults.clear();
|
||||||
|
panelResults.add(new HTML("<hr>"));
|
||||||
|
panelResults.add(new LoaderIcon("Filtering..."));
|
||||||
|
try {
|
||||||
|
|
||||||
|
Request response = builder.sendRequest(null, new RequestCallback() {
|
||||||
|
public void onError(Request request, Throwable exception) {
|
||||||
|
// showLoading(false);
|
||||||
|
// Window.alert(caught.getMessage());
|
||||||
|
panelResults.clear();
|
||||||
|
panelResults.add(new HTML("<hr>"));
|
||||||
|
Alert alert = new Alert("Error on returning number of centroids");
|
||||||
|
alert.setType(AlertType.ERROR);
|
||||||
|
alert.setClose(false);
|
||||||
|
panelResults.add(alert);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onResponseReceived(Request request, Response response) {
|
||||||
|
|
||||||
|
Feature[] features = OLGeoJSONUtil.readGeoJsonFeatures(MAP_PROJECTION.EPSG_4326,
|
||||||
|
response.getText());
|
||||||
|
|
||||||
|
if (features != null) {
|
||||||
|
int dataCount = features.length;
|
||||||
|
|
||||||
|
panelResults.clear();
|
||||||
|
panelResults.add(new HTML("<hr>"));
|
||||||
|
|
||||||
|
if (dataCount == 0) {
|
||||||
|
panelResults.add(new HTML("No result found"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String message = "";
|
||||||
|
|
||||||
|
if (dataCount > 0) {
|
||||||
|
message = "Found " + dataCount;
|
||||||
|
message += dataCount > 1 ? " centroids" : " centroid";
|
||||||
|
message += ". ";
|
||||||
|
}
|
||||||
|
|
||||||
|
HTML resultMessage = new HTML(message);
|
||||||
|
resultMessage.getElement().addClassName("search_result_msg");
|
||||||
|
|
||||||
|
panelResults.add(resultMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
} catch (RequestException e) {
|
||||||
|
panelResults.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -416,11 +504,12 @@ public class CrossFilteringLayerPanel extends Composite {
|
||||||
* @param selectableItemValue the selectable item value
|
* @param selectableItemValue the selectable item value
|
||||||
*/
|
*/
|
||||||
private void loadInnerLevel(int level, String selectableItemValue) {
|
private void loadInnerLevel(int level, String selectableItemValue) {
|
||||||
GWT.log("selected level " + level + " selectableItemValue " + selectableItemValue);
|
// GWT.log("selected level " + level + " selectableItemValue " +
|
||||||
|
// selectableItemValue);
|
||||||
HashMap<String, SelectableItem> mapSelectableItem = mapInnestedFeatures.get(level);
|
HashMap<String, SelectableItem> mapSelectableItem = mapInnestedFeatures.get(level);
|
||||||
SelectableItem selectedItem = mapSelectableItem.get(selectableItemValue);
|
SelectableItem selectedItem = mapSelectableItem.get(selectableItemValue);
|
||||||
|
|
||||||
GWT.log("selected selectableItem " + selectedItem);
|
// GWT.log("selected selectableItem " + selectedItem);
|
||||||
int innerLevel = level + 1;
|
int innerLevel = level + 1;
|
||||||
List<? extends LayerIDV> selectedLayers = mapInnestedFiltering.get(innerLevel);
|
List<? extends LayerIDV> selectedLayers = mapInnestedFiltering.get(innerLevel);
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
<b:Fieldset ui:field="fieldSet">
|
<b:Fieldset ui:field="fieldSet">
|
||||||
</b:Fieldset>
|
</b:Fieldset>
|
||||||
</b:Form>
|
</b:Form>
|
||||||
|
<g:HTMLPanel ui:field="panelResults">
|
||||||
|
</g:HTMLPanel>
|
||||||
<b:Button icon="REMOVE_CIRCLE" ui:field="buttonReset"
|
<b:Button icon="REMOVE_CIRCLE" ui:field="buttonReset"
|
||||||
title="Reset the filter">Reset</b:Button>
|
title="Reset the filter">Reset</b:Button>
|
||||||
</g:HTMLPanel>
|
</g:HTMLPanel>
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.util;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.WFSGetFeature;
|
||||||
|
|
||||||
|
import com.google.gwt.http.client.URL;
|
||||||
|
|
||||||
|
public class WFSMakerUtil {
|
||||||
|
|
||||||
|
public static final String CQL_FILTER_PARAMETER = "CQL_FILTER";
|
||||||
|
|
||||||
|
public static String buildWFSRequest(String webserviceURL, String layerName, int maxFeatures, String propertyName,
|
||||||
|
String cqlFilter) throws Exception {
|
||||||
|
|
||||||
|
if (layerName == null)
|
||||||
|
throw new Exception("Bad parameter layerName is null");
|
||||||
|
|
||||||
|
if (webserviceURL == null)
|
||||||
|
throw new Exception("Bad parameter webserviceURL is null");
|
||||||
|
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append(webserviceURL);
|
||||||
|
builder.append("?");
|
||||||
|
builder.append(WFSGetFeature.SERVICE.getParameter() + "=" + WFSGetFeature.SERVICE.getValue());
|
||||||
|
builder.append("&");
|
||||||
|
builder.append(WFSGetFeature.VERSION.getParameter() + "=" + WFSGetFeature.VERSION.getValue());
|
||||||
|
builder.append("&");
|
||||||
|
builder.append(WFSGetFeature.REQUEST.getParameter() + "=" + WFSGetFeature.REQUEST.getValue());
|
||||||
|
builder.append("&");
|
||||||
|
builder.append(WFSGetFeature.OUTPUTFORMAT.getParameter() + "=" + URL.encode("application/json"));
|
||||||
|
builder.append("&");
|
||||||
|
builder.append(WFSGetFeature.TYPENAME.getParameter() + "=" + layerName);
|
||||||
|
builder.append("&");
|
||||||
|
|
||||||
|
if (maxFeatures > 0) {
|
||||||
|
builder.append(WFSGetFeature.MAXFEATURES.getParameter() + "=" + maxFeatures);
|
||||||
|
builder.append("&");
|
||||||
|
}
|
||||||
|
if (propertyName != null) {
|
||||||
|
builder.append(WFSGetFeature.PROPERTYNAME.getParameter() + "=" + propertyName);
|
||||||
|
builder.append("&");
|
||||||
|
}
|
||||||
|
if (cqlFilter != null) {
|
||||||
|
builder.append(CQL_FILTER_PARAMETER + "=" + cqlFilter);
|
||||||
|
}
|
||||||
|
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -4,6 +4,7 @@ import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
||||||
import org.gcube.application.geoportalcommon.util.URLParserUtil;
|
import org.gcube.application.geoportalcommon.util.URLParserUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.gis.MapServerRecognize.SERVERTYPE;
|
import org.gcube.portlets.user.geoportaldataviewer.server.gis.MapServerRecognize.SERVERTYPE;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.WFSGetFeature;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
|
@ -12,12 +12,10 @@ import org.gcube.spatial.data.geoutility.wms.WmsUrlValidator;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class GisViewerWMSUrlValidator.
|
* The Class GisViewerWMSUrlValidator.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Jan 28, 2016
|
||||||
* Jan 28, 2016
|
|
||||||
*/
|
*/
|
||||||
public class WMSUrlValidator {
|
public class WMSUrlValidator {
|
||||||
|
|
||||||
|
@ -35,7 +33,6 @@ public class WMSUrlValidator {
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(WMSUrlValidator.class);
|
private static final Logger LOG = LoggerFactory.getLogger(WMSUrlValidator.class);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new WMS url validator.
|
* Instantiates a new WMS url validator.
|
||||||
*
|
*
|
||||||
|
@ -47,7 +44,6 @@ public class WMSUrlValidator {
|
||||||
LOG.debug("WMSURLValidator wmsRequest: " + wmsRequest);
|
LOG.debug("WMSURLValidator wmsRequest: " + wmsRequest);
|
||||||
LOG.debug("WMSURLValidator layerName: " + inputLayerName);
|
LOG.debug("WMSURLValidator layerName: " + inputLayerName);
|
||||||
|
|
||||||
|
|
||||||
if (wmsRequest == null || wmsRequest.isEmpty())
|
if (wmsRequest == null || wmsRequest.isEmpty())
|
||||||
throw new Exception("WMS request is null or empty");
|
throw new Exception("WMS request is null or empty");
|
||||||
|
|
||||||
|
@ -71,7 +67,8 @@ public class WMSUrlValidator {
|
||||||
try {
|
try {
|
||||||
// VALIDATE WMS SERVICE FOR WEB MAP SERVER
|
// VALIDATE WMS SERVICE FOR WEB MAP SERVER
|
||||||
if (!HttpRequestUtil.urlExists(this.wmsServiceHost, true)) {
|
if (!HttpRequestUtil.urlExists(this.wmsServiceHost, true)) {
|
||||||
LOG.info("baseWmsServiceUrl: "+wmsServiceHost +" is not a geoserver, setting as input base wms server: "+baseWmsService);
|
LOG.info("baseWmsServiceUrl: " + wmsServiceHost
|
||||||
|
+ " is not a geoserver, setting as input base wms server: " + baseWmsService);
|
||||||
this.wmsServiceHost = baseWmsService;
|
this.wmsServiceHost = baseWmsService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +90,6 @@ public class WMSUrlValidator {
|
||||||
parametersValue.put(WmsParameters.LAYERS.getParameter(), this.layerName);
|
parametersValue.put(WmsParameters.LAYERS.getParameter(), this.layerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append wms service to base url.
|
* Append wms service to base url.
|
||||||
*
|
*
|
||||||
|
@ -117,13 +113,14 @@ public class WMSUrlValidator {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: getFullWmsUrlRequest
|
* Method: getFullWmsUrlRequest Create a correct wms url request Returns:
|
||||||
* Create a correct wms url request
|
|
||||||
* Returns:
|
|
||||||
* {String}.
|
* {String}.
|
||||||
*
|
*
|
||||||
* @param returnEmptyParameter if true the wms url returned contains also wms parameter with empty value, none otherwise.
|
* @param returnEmptyParameter if true the wms url returned contains also
|
||||||
* and mandatory wms parameters that does not found are filled with empty values
|
* wms parameter with empty value, none
|
||||||
|
* otherwise. and mandatory wms parameters
|
||||||
|
* that does not found are filled with empty
|
||||||
|
* values
|
||||||
* @param fillEmptyParameterAsDefault the fill empty parameter as default
|
* @param fillEmptyParameterAsDefault the fill empty parameter as default
|
||||||
* @return a correct wms url request in formatted string like this:
|
* @return a correct wms url request in formatted string like this:
|
||||||
* "wmsserver?key1=value1&key2=value2&key3=value3"
|
* "wmsserver?key1=value1&key2=value2&key3=value3"
|
||||||
|
@ -138,20 +135,25 @@ public class WMSUrlValidator {
|
||||||
parametersValue.putAll(urlValidator.getMapWmsParameters());
|
parametersValue.putAll(urlValidator.getMapWmsParameters());
|
||||||
|
|
||||||
String ln = parametersValue.get(WmsParameters.LAYERS.name());
|
String ln = parametersValue.get(WmsParameters.LAYERS.name());
|
||||||
LOG.debug("Comparing layer name from Wms request: "+ln +", with OnLineResource layerName: "+this.layerName);
|
LOG.debug("Comparing layer name from Wms request: " + ln + ", with OnLineResource layerName: "
|
||||||
|
+ this.layerName);
|
||||||
if (ln == null || ln.isEmpty() || ln.compareTo(this.layerName) != 0) {
|
if (ln == null || ln.isEmpty() || ln.compareTo(this.layerName) != 0) {
|
||||||
LOG.info("Layer name into wms request is different to OnLineResource layers name, replacing layer name: "+this.layerName);
|
LOG.info(
|
||||||
|
"Layer name into wms request is different to OnLineResource layers name, replacing layer name: "
|
||||||
|
+ this.layerName);
|
||||||
parametersValue.put(WmsParameters.LAYERS.getParameter(), this.layerName);
|
parametersValue.put(WmsParameters.LAYERS.getParameter(), this.layerName);
|
||||||
urlValidator.getMapWmsParameters().put(org.gcube.spatial.data.geoutility.bean.WmsParameters.LAYERS.getParameter(), this.layerName);
|
urlValidator.getMapWmsParameters().put(
|
||||||
fullWmsUrlBuilded = org.gcube.spatial.data.geoutility.wms.WmsUrlValidator.setValueOfParameter(org.gcube.spatial.data.geoutility.bean.WmsParameters.LAYERS, fullWmsUrlBuilded, this.layerName, true);
|
org.gcube.spatial.data.geoutility.bean.WmsParameters.LAYERS.getParameter(), this.layerName);
|
||||||
|
fullWmsUrlBuilded = org.gcube.spatial.data.geoutility.wms.WmsUrlValidator.setValueOfParameter(
|
||||||
|
org.gcube.spatial.data.geoutility.bean.WmsParameters.LAYERS, fullWmsUrlBuilded, this.layerName,
|
||||||
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// logger.trace("parametersValue: "+parametersValue);
|
// logger.trace("parametersValue: "+parametersValue);
|
||||||
mapWmsNoStandardParams = new HashMap<String, String>(urlValidator.getMapWmsNoStandardParams().size());
|
mapWmsNoStandardParams = new HashMap<String, String>(urlValidator.getMapWmsNoStandardParams().size());
|
||||||
mapWmsNoStandardParams.putAll(urlValidator.getMapWmsNoStandardParams());
|
mapWmsNoStandardParams.putAll(urlValidator.getMapWmsNoStandardParams());
|
||||||
wmsNoStandardParameters = urlValidator.getWmsNoStandardParameters();
|
wmsNoStandardParameters = urlValidator.getWmsNoStandardParameters();
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
|
||||||
LOG.error("An error occurred during wms uri build, returning uri: " + wmsRequestURI, e);
|
LOG.error("An error occurred during wms uri build, returning uri: " + wmsRequestURI, e);
|
||||||
fullWmsUrlBuilded = wmsRequestURI;
|
fullWmsUrlBuilded = wmsRequestURI;
|
||||||
}
|
}
|
||||||
|
@ -160,13 +162,12 @@ public class WMSUrlValidator {
|
||||||
return fullWmsUrlBuilded;
|
return fullWmsUrlBuilded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the web map server host.
|
* Gets the web map server host.
|
||||||
*
|
*
|
||||||
* @param wmsRequest the wms request
|
* @param wmsRequest the wms request
|
||||||
* @return the web map server host, (geoserver URI or the wmsRequest substring from start to index of '?' char (if exists))
|
* @return the web map server host, (geoserver URI or the wmsRequest substring
|
||||||
|
* from start to index of '?' char (if exists))
|
||||||
*/
|
*/
|
||||||
public WebMapServerHost getWebMapServerHost(String wmsRequest) {
|
public WebMapServerHost getWebMapServerHost(String wmsRequest) {
|
||||||
|
|
||||||
|
@ -175,7 +176,6 @@ public class WMSUrlValidator {
|
||||||
if (wmsRequest == null)
|
if (wmsRequest == null)
|
||||||
return webMapServerHost; // uri is empty
|
return webMapServerHost; // uri is empty
|
||||||
|
|
||||||
|
|
||||||
int end = wmsRequest.toLowerCase().lastIndexOf("?");
|
int end = wmsRequest.toLowerCase().lastIndexOf("?");
|
||||||
|
|
||||||
if (end == -1) {
|
if (end == -1) {
|
||||||
|
@ -193,7 +193,8 @@ public class WMSUrlValidator {
|
||||||
int lastSlash = webMapServerBaseURL.lastIndexOf("/");
|
int lastSlash = webMapServerBaseURL.lastIndexOf("/");
|
||||||
int includeGeoserverString = index + GEOSERVER.length();
|
int includeGeoserverString = index + GEOSERVER.length();
|
||||||
int endUrl = lastSlash > includeGeoserverString ? lastSlash : includeGeoserverString;
|
int endUrl = lastSlash > includeGeoserverString ? lastSlash : includeGeoserverString;
|
||||||
LOG.trace("indexs - lastSlash: ["+lastSlash+"], includeGeoserverString: ["+includeGeoserverString+"], endUrl: ["+endUrl+"]");
|
LOG.trace("indexs - lastSlash: [" + lastSlash + "], includeGeoserverString: [" + includeGeoserverString
|
||||||
|
+ "], endUrl: [" + endUrl + "]");
|
||||||
int startScope = includeGeoserverString + 1 < endUrl ? includeGeoserverString + 1 : endUrl; // INCLUDE SLASH
|
int startScope = includeGeoserverString + 1 < endUrl ? includeGeoserverString + 1 : endUrl; // INCLUDE SLASH
|
||||||
String scope = webMapServerBaseURL.substring(startScope, endUrl);
|
String scope = webMapServerBaseURL.substring(startScope, endUrl);
|
||||||
LOG.trace("geoserver url include scope: " + webMapServerBaseURL.substring(includeGeoserverString, endUrl));
|
LOG.trace("geoserver url include scope: " + webMapServerBaseURL.substring(includeGeoserverString, endUrl));
|
||||||
|
@ -214,8 +215,7 @@ public class WMSUrlValidator {
|
||||||
LOG.trace("url: " + urlConn + " - open a connection, return " + urlConn);
|
LOG.trace("url: " + urlConn + " - open a connection, return " + urlConn);
|
||||||
webMapServerHost.setHost(urlConn);
|
webMapServerHost.setHost(urlConn);
|
||||||
return webMapServerHost;
|
return webMapServerHost;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
LOG.trace("url: " + urlConn + " - not open a connection");
|
LOG.trace("url: " + urlConn + " - not open a connection");
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -229,7 +229,6 @@ public class WMSUrlValidator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the wms service host.
|
* Gets the wms service host.
|
||||||
*
|
*
|
||||||
|
@ -260,7 +259,6 @@ public class WMSUrlValidator {
|
||||||
return wmsNoStandardParameters;
|
return wmsNoStandardParameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the value of parsed wms parameter.
|
* Gets the value of parsed wms parameter.
|
||||||
*
|
*
|
||||||
|
@ -272,7 +270,6 @@ public class WMSUrlValidator {
|
||||||
return parametersValue.get(parameter.getParameter());
|
return parametersValue.get(parameter.getParameter());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the value of parameter.
|
* Gets the value of parameter.
|
||||||
*
|
*
|
||||||
|
@ -285,7 +282,6 @@ public class WMSUrlValidator {
|
||||||
return WmsUrlValidator.getValueOfParameter(wmsParam, wmsUrlParameters);
|
return WmsUrlValidator.getValueOfParameter(wmsParam, wmsUrlParameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the value of parameter.
|
* Sets the value of parameter.
|
||||||
*
|
*
|
||||||
|
@ -295,7 +291,8 @@ public class WMSUrlValidator {
|
||||||
* @param addIfNotExists the add if not exists
|
* @param addIfNotExists the add if not exists
|
||||||
* @return the string
|
* @return the string
|
||||||
*/
|
*/
|
||||||
public static String setValueOfParameter(WmsParameters wmsParam, String wmsUrlParameters, String newValue, boolean addIfNotExists){
|
public static String setValueOfParameter(WmsParameters wmsParam, String wmsUrlParameters, String newValue,
|
||||||
|
boolean addIfNotExists) {
|
||||||
|
|
||||||
return WmsUrlValidator.setValueOfParameter(wmsParam, wmsUrlParameters, newValue, addIfNotExists);
|
return WmsUrlValidator.setValueOfParameter(wmsParam, wmsUrlParameters, newValue, addIfNotExists);
|
||||||
}
|
}
|
||||||
|
@ -309,8 +306,6 @@ public class WMSUrlValidator {
|
||||||
return layerName;
|
return layerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the styles as list.
|
* Gets the styles as list.
|
||||||
*
|
*
|
||||||
|
@ -332,7 +327,6 @@ public class WMSUrlValidator {
|
||||||
return listStyles;
|
return listStyles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the map wms no standard params.
|
* Gets the map wms no standard params.
|
||||||
*
|
*
|
||||||
|
@ -342,63 +336,4 @@ public class WMSUrlValidator {
|
||||||
return mapWmsNoStandardParams;
|
return mapWmsNoStandardParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The main method.
|
|
||||||
*
|
|
||||||
* @param args the arguments
|
|
||||||
*/
|
|
||||||
public static void main(String[] args) {
|
|
||||||
|
|
||||||
// String baseGeoserverUrl = "http://repoigg.services.iit.cnr.it:8080/geoserver/IGG/ows";
|
|
||||||
// String baseGeoserverUrl = "http://www.fao.org/figis/geoserver/species";
|
|
||||||
// String fullPath = "http://www.fao.org/figis/geoserver/species?SERVICE=WMS&BBOX=-176.0,-90.0,180.0,90&styles=Species_prob, puppa&layers=layerName&FORMAT=image/gif";
|
|
||||||
// String fullPath = "http://repoigg.services.iit.cnr.it:8080/geoserver/IGG/ows?service=wms&version=1.1.0&request=GetMap&layers==IGG:area_temp_1000&width=676&height=330&srs=EPSG:4326&crs=EPSG:4326&format=application/openlayers&bbox=-85.5,-180.0,90.0,180.0";
|
|
||||||
// String baseGeoserverUrl = "http://thredds-d-d4s.d4science.org/thredds/wms/public/netcdf/test20.nc";
|
|
||||||
// String fullPath = "http://thredds-d-d4s.d4science.org/thredds/wms/public/netcdf/test20.nc?service=wms&version=1.3.0&request=GetMap&layers=analyzed_field&bbox=-85.0,-180.0,85.0,180.0&styles=&width=640&height=480&srs=EPSG:4326&CRS=EPSG:4326&format=image/png&COLORSCALERANGE=auto";
|
|
||||||
// WmsUrlValidator validator = new WmsUrlValidator(baseGeoserverUrl, fullPath , "", false);
|
|
||||||
// logger.trace("base wms service url: "+validator.getBaseWmsServiceUrl());
|
|
||||||
// logger.trace("layer name: "+validator.getLayerName());
|
|
||||||
// logger.trace("full wms url: "+validator.getFullWmsUrlRequest(false, true));
|
|
||||||
// logger.trace("style: "+validator.getStyles());
|
|
||||||
// logger.trace("not standard parameter: "+validator.getWmsNotStandardParameters());
|
|
||||||
// String[] arrayStyle = validator.getStyles().split(",");
|
|
||||||
//
|
|
||||||
// if(arrayStyle!=null && arrayStyle.length>0){
|
|
||||||
//
|
|
||||||
// for (String style : arrayStyle) {
|
|
||||||
// if(style!=null && !style.isEmpty())
|
|
||||||
//
|
|
||||||
// System.out.println("Style: "+style.trim());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// String fullPath = "http://thredds-d-d4s.d4science.org/thredds/wms/public/netcdf/test20.nc?service=wms&version=1.3.0&request=GetMap&layers=analyzed_field&bbox=-85.0,-180.0,85.0,180.0&styles=&width=640&height=480&srs=EPSG:4326&CRS=EPSG:4326&format=image/png&COLORSCALERANGE=auto";
|
|
||||||
//
|
|
||||||
// WmsGeoExplorerUrlValidator validator = new WmsGeoExplorerUrlValidator("http://thredds-d-d4s.d4science.org/thredds/wms/public/netcdf/test20.nc", fullPath , "", false);
|
|
||||||
// validator.getFullWmsUrlRequest(false,true);
|
|
||||||
//
|
|
||||||
// System.out.println(validator.getWmsNoStandardParameters());
|
|
||||||
// System.out.println(validator.getMapWmsNoStandardParams());
|
|
||||||
|
|
||||||
// fullPath = WmsUrlValidator.setValueOfParameter(WmsParameters.STYLES, fullPath, "123", true);
|
|
||||||
//
|
|
||||||
|
|
||||||
// MapPreviewGenerator map = new MapPreviewGenerator();
|
|
||||||
// fullPath = map.buildWmsRequestMapPreview(fullPath, "-85.0,-180.0,85.0,180.0");
|
|
||||||
// System.out.println(fullPath);
|
|
||||||
|
|
||||||
String wmsRequest = "http://geoserver-dev.d4science-ii.research-infrastructures.eu/geoserver/wms?CRS=EPSG:4326&BBOX=-85.5,-180.0,90.0,180.0&VERSION=1.1.0&FORMAT=application/openlayers&SERVICE=wms&HEIGHT=330&LAYERS=aquamaps:lsoleasolea20130716162322254cest&REQUEST=GetMap&STYLES=Species_prob&SRS=EPSG:4326&WIDTH=676";
|
|
||||||
// String wmsRequest = "http://thredds-d-d4s.d4science.org/thredds/wms/public/netcdf/test20.nc?service=wms&version=1.3.0&request=GetMap&layers=analyzed_field&styles=&width=640&height=480&srs=EPSG:4326&CRS=EPSG:4326&format=image/png&COLORSCALERANGE=auto&bbox=-85.0,-180.0,85.0,180.0";
|
|
||||||
WmsUrlValidator wms;
|
|
||||||
try {
|
|
||||||
wms = new WmsUrlValidator(wmsRequest);
|
|
||||||
System.out.println("Returned wms: "+wms.toString());
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.server.gis;
|
package org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Enum WfsParameters.
|
* The Enum WfsParameters.
|
||||||
|
@ -20,6 +18,7 @@ public enum WFSGetFeature {
|
||||||
WIDTH("WIDTH","676"),
|
WIDTH("WIDTH","676"),
|
||||||
HEIGHT("HEIGHT","230"),
|
HEIGHT("HEIGHT","230"),
|
||||||
SRSNAME("srsName","EPSG:4326"),
|
SRSNAME("srsName","EPSG:4326"),
|
||||||
|
PROPERTYNAME("propertyName", ""),
|
||||||
// CRS("CRS","EPSG:4326"), //WMS 1.3.0 COMPLIANT
|
// CRS("CRS","EPSG:4326"), //WMS 1.3.0 COMPLIANT
|
||||||
OUTPUTFORMAT("OUTPUTFORMAT","json"),
|
OUTPUTFORMAT("OUTPUTFORMAT","json"),
|
||||||
MAXFEATURES("MAXFEATURES","");
|
MAXFEATURES("MAXFEATURES","");
|
|
@ -0,0 +1,84 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.gcube.spatial.data.geoutility.GeoWmsServiceUtility;
|
||||||
|
import org.gcube.spatial.data.geoutility.bean.WmsParameters;
|
||||||
|
import org.gcube.spatial.data.geoutility.util.HttpRequestUtil;
|
||||||
|
import org.gcube.spatial.data.geoutility.wms.WmsUrlValidator;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class WMSUrlValidatorTest.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Jun 1, 2023
|
||||||
|
*/
|
||||||
|
public class WMSUrlValidatorTest {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The main method.
|
||||||
|
*
|
||||||
|
* @param args the arguments
|
||||||
|
*/
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// String baseGeoserverUrl = "http://repoigg.services.iit.cnr.it:8080/geoserver/IGG/ows";
|
||||||
|
// String baseGeoserverUrl = "http://www.fao.org/figis/geoserver/species";
|
||||||
|
// String fullPath = "http://www.fao.org/figis/geoserver/species?SERVICE=WMS&BBOX=-176.0,-90.0,180.0,90&styles=Species_prob, puppa&layers=layerName&FORMAT=image/gif";
|
||||||
|
// String fullPath = "http://repoigg.services.iit.cnr.it:8080/geoserver/IGG/ows?service=wms&version=1.1.0&request=GetMap&layers==IGG:area_temp_1000&width=676&height=330&srs=EPSG:4326&crs=EPSG:4326&format=application/openlayers&bbox=-85.5,-180.0,90.0,180.0";
|
||||||
|
// String baseGeoserverUrl = "http://thredds-d-d4s.d4science.org/thredds/wms/public/netcdf/test20.nc";
|
||||||
|
// String fullPath = "http://thredds-d-d4s.d4science.org/thredds/wms/public/netcdf/test20.nc?service=wms&version=1.3.0&request=GetMap&layers=analyzed_field&bbox=-85.0,-180.0,85.0,180.0&styles=&width=640&height=480&srs=EPSG:4326&CRS=EPSG:4326&format=image/png&COLORSCALERANGE=auto";
|
||||||
|
// WmsUrlValidator validator = new WmsUrlValidator(baseGeoserverUrl, fullPath , "", false);
|
||||||
|
// logger.trace("base wms service url: "+validator.getBaseWmsServiceUrl());
|
||||||
|
// logger.trace("layer name: "+validator.getLayerName());
|
||||||
|
// logger.trace("full wms url: "+validator.getFullWmsUrlRequest(false, true));
|
||||||
|
// logger.trace("style: "+validator.getStyles());
|
||||||
|
// logger.trace("not standard parameter: "+validator.getWmsNotStandardParameters());
|
||||||
|
// String[] arrayStyle = validator.getStyles().split(",");
|
||||||
|
//
|
||||||
|
// if(arrayStyle!=null && arrayStyle.length>0){
|
||||||
|
//
|
||||||
|
// for (String style : arrayStyle) {
|
||||||
|
// if(style!=null && !style.isEmpty())
|
||||||
|
//
|
||||||
|
// System.out.println("Style: "+style.trim());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// String fullPath = "http://thredds-d-d4s.d4science.org/thredds/wms/public/netcdf/test20.nc?service=wms&version=1.3.0&request=GetMap&layers=analyzed_field&bbox=-85.0,-180.0,85.0,180.0&styles=&width=640&height=480&srs=EPSG:4326&CRS=EPSG:4326&format=image/png&COLORSCALERANGE=auto";
|
||||||
|
//
|
||||||
|
// WmsGeoExplorerUrlValidator validator = new WmsGeoExplorerUrlValidator("http://thredds-d-d4s.d4science.org/thredds/wms/public/netcdf/test20.nc", fullPath , "", false);
|
||||||
|
// validator.getFullWmsUrlRequest(false,true);
|
||||||
|
//
|
||||||
|
// System.out.println(validator.getWmsNoStandardParameters());
|
||||||
|
// System.out.println(validator.getMapWmsNoStandardParams());
|
||||||
|
|
||||||
|
// fullPath = WmsUrlValidator.setValueOfParameter(WmsParameters.STYLES, fullPath, "123", true);
|
||||||
|
//
|
||||||
|
|
||||||
|
// MapPreviewGenerator map = new MapPreviewGenerator();
|
||||||
|
// fullPath = map.buildWmsRequestMapPreview(fullPath, "-85.0,-180.0,85.0,180.0");
|
||||||
|
// System.out.println(fullPath);
|
||||||
|
|
||||||
|
String wmsRequest = "http://geoserver-dev.d4science-ii.research-infrastructures.eu/geoserver/wms?CRS=EPSG:4326&BBOX=-85.5,-180.0,90.0,180.0&VERSION=1.1.0&FORMAT=application/openlayers&SERVICE=wms&HEIGHT=330&LAYERS=aquamaps:lsoleasolea20130716162322254cest&REQUEST=GetMap&STYLES=Species_prob&SRS=EPSG:4326&WIDTH=676";
|
||||||
|
// String wmsRequest = "http://thredds-d-d4s.d4science.org/thredds/wms/public/netcdf/test20.nc?service=wms&version=1.3.0&request=GetMap&layers=analyzed_field&styles=&width=640&height=480&srs=EPSG:4326&CRS=EPSG:4326&format=image/png&COLORSCALERANGE=auto&bbox=-85.0,-180.0,85.0,180.0";
|
||||||
|
WmsUrlValidator wms;
|
||||||
|
try {
|
||||||
|
wms = new WmsUrlValidator(wmsRequest);
|
||||||
|
System.out.println("Returned wms: "+wms.toString());
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue