reading new properties

This commit is contained in:
Francesco Mangiacrapa 2020-10-29 17:57:29 +01:00
parent 7f56579113
commit 86353ede48
3 changed files with 25 additions and 11 deletions

View File

@ -84,9 +84,9 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
* @see org.gcube.portlets.user.gisviewer.client.GisViewerService#getDataResult(java.util.List, java.lang.String, int)
*/
@Override
public List<GeoNaDataObject> getDataResult(List<LayerItem> layerItems, String mapSrsName, BoundsMap mapBBOX, int maxWFSFeature, double zoomLevel) {
public List<GeoNaDataObject> getDataResult(List<LayerItem> layerItems, String mapSrsName, BoundsMap selectBBOX, int maxWFSFeature, double zoomLevel) {
LOG.info("getDataResult called");
List<GeoNaDataObject> result = FeatureParser.getDataResults(layerItems, mapSrsName, mapBBOX, maxWFSFeature);
List<GeoNaDataObject> result = FeatureParser.getDataResults(layerItems, mapSrsName, selectBBOX, maxWFSFeature);
return result;
}

View File

@ -48,11 +48,11 @@ public class FeatureParser {
*
* @param layerItems the layer items
* @param mapSrsName the map srs name
* @param mapBBOX the map BBOX
* @param selectBBOX the select BBOX
* @param maxWFSFeature the max WFS feature
* @return the data results
*/
public static List<GeoNaDataObject> getDataResults(List<LayerItem> layerItems, String mapSrsName, BoundsMap mapBBOX, int maxWFSFeature) {
public static List<GeoNaDataObject> getDataResults(List<LayerItem> layerItems, String mapSrsName, BoundsMap selectBBOX, int maxWFSFeature) {
if(maxWFSFeature<0) {
maxWFSFeature = GeoportalDataViewerConstants.MAX_WFS_FEATURES;
@ -61,7 +61,7 @@ public class FeatureParser {
List<GeoNaDataObject> listGeonaDO = new ArrayList<GeoNaDataObject>();
//IF WFS IS AVAILABLE USE WFS REQUEST OTHERWHISE TRY TO USE WPS SERVICE
for (LayerItem layerItem : layerItems){
List<FeatureRow> rows = getWFSFeatureProperties(layerItem, mapSrsName, mapBBOX, maxWFSFeature);
List<FeatureRow> rows = getWFSFeatureProperties(layerItem, mapSrsName, selectBBOX, maxWFSFeature);
GeoNaDataObject gdo = new GeoNaDataObject();
gdo.setLayerItem(layerItem);
for (FeatureRow featureRow : rows) {
@ -71,24 +71,24 @@ public class FeatureParser {
return null;
}
/**
* Gets the WFS feature properties.
*
* @param layerItem the layer item
* @param mapSrsName the map srs name
* @param mapBBOX the map BBOX
* @param selectBBOX the select BBOX
* @param maxWFSFeature the max WFS feature
* @return the WFS feature properties
*/
@SuppressWarnings("unchecked")
private static List<FeatureRow> getWFSFeatureProperties(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxWFSFeature) {
private static List<FeatureRow> getWFSFeatureProperties(LayerItem layerItem, String mapSrsName, BoundsMap selectBBOX, int maxWFSFeature) {
LOG.info("getWFSFeatureProperties for layerItem: "+layerItem.getName() +" in the "+mapBBOX);
LOG.info("getWFSFeatureProperties for layerItem: "+layerItem.getName() +" in the "+selectBBOX);
InputStream is = null;
List<FeatureRow> listFeaturesRow = new ArrayList<FeatureRow>();
try {
String url = GisMakers.buildWFSFeatureQuery(layerItem, mapSrsName, mapBBOX, maxWFSFeature, GisMakers.JSON);
String url = GisMakers.buildWFSFeatureQuery(layerItem, mapSrsName, selectBBOX, maxWFSFeature, GisMakers.JSON);
String cqlFilterValue = URLParserUtil.extractValueOfParameterFromURL(GisMakers.CQL_FILTER_PARAMETER, url);
LOG.info("Found CQL filter value into query string: "+cqlFilterValue);
@ -116,6 +116,11 @@ public class FeatureParser {
LOG.info("No features detected in the response, returning empty list");
return listFeaturesRow;
}
JSONObject crs = json.getJSONObject("crs");
JSONObject crsProp = crs.getJSONObject("properties");
LOG.info("Features are: "+features.length());
for (int i=0; i<features.length(); i++) {

View File

@ -26,6 +26,8 @@ public class FeatureRow implements Serializable {
private Map<String, List<String>> mapProperties;
private FeatureGeometry geometry;
private String crsName;
public FeatureRow() {
}
@ -43,7 +45,14 @@ public class FeatureRow implements Serializable {
public void setMapProperties(Map<String, List<String>> mapProperties) {
this.mapProperties = mapProperties;
}
public String getCrsName() {
return crsName;
}
public void setCrsName(String crsName) {
this.crsName = crsName;
}
public FeatureGeometry getGeometry() {
return geometry;