/** * Parses UNION method parameters for WPS execute xml variables Originally * vec:UnionFeatureCollection Changed to geom union (gs:feature + subprocess gs:CollectGeometries * * @param lc WFS layer configuration * @param json Method parameters and layer info from the front * @param baseUrl Url for Geoserver WPS reference input (input FeatureCollection) * @return UnionMethodParams parameters for WPS execution * ********************************************************************** */ private UnionMethodParams parseUnionParams( WFSLayerConfiguration lc, JSONObject json, String baseUrl) throws ServiceException { UnionMethodParams method = new UnionMethodParams(); // method.setMethod(UNION); // General variable input and variable input of union input 1 method.setLayer_id(ConversionHelper.getInt(lc.getLayerId(), 0)); method.setServiceUrl(lc.getURL()); baseUrl = baseUrl.replace("&", "&"); method.setHref(baseUrl + String.valueOf(lc.getLayerId())); method.setTypeName(lc.getFeatureNamespace() + ":" + lc.getFeatureElement()); method.setLocalTypeName(lc.getFeatureElement()); method.setMaxFeatures(String.valueOf(lc.getMaxFeatures())); method.setSrsName(lc.getSRSName()); method.setOutputFormat(DEFAULT_OUTPUT_FORMAT); method.setVersion(lc.getWFSVersion()); method.setXmlns( "xmlns:" + lc.getFeatureNamespace() + "=\"" + lc.getFeatureNamespaceURI() + "\""); method.setGeom(lc.getGMLGeometryProperty()); JSONObject bbox = null; try { bbox = json.getJSONObject("bbox"); method.setX_lower(bbox.optString("left")); method.setY_lower(bbox.optString("bottom")); method.setX_upper(bbox.optString("right")); method.setY_upper(bbox.optString("top")); } catch (JSONException e) { throw new ServiceException("Bbox parameters missing."); } return method; }
/** * Parses BUFFER method parameters for WPS execute xml variables * * @param lc WFS layer configuration * @param json Method parameters and layer info from the front * @param baseUrl Url for Geoserver WPS reference input (input FeatureCollection) * @return BufferMethodParams parameters for WPS execution * ********************************************************************** */ private BufferMethodParams parseBufferParams( WFSLayerConfiguration lc, JSONObject json, String baseUrl) throws ServiceException { final BufferMethodParams method = new BufferMethodParams(); method.setMethod(BUFFER); // try { method.setLayer_id(ConversionHelper.getInt(lc.getLayerId(), 0)); method.setServiceUrl(lc.getURL()); baseUrl = baseUrl.replace("&", "&"); method.setHref(baseUrl + String.valueOf(lc.getLayerId())); method.setTypeName(lc.getFeatureNamespace() + ":" + lc.getFeatureElement()); method.setMaxFeatures(String.valueOf(lc.getMaxFeatures())); method.setSrsName(lc.getSRSName()); method.setOutputFormat(DEFAULT_OUTPUT_FORMAT); method.setVersion(lc.getWFSVersion()); method.setXmlns( "xmlns:" + lc.getFeatureNamespace() + "=\"" + lc.getFeatureNamespaceURI() + "\""); method.setGeom(lc.getGMLGeometryProperty()); final JSONObject params = json.getJSONObject(JSON_KEY_METHODPARAMS); final JSONObject bbox = json.getJSONObject("bbox"); method.setX_lower(bbox.optString("left")); method.setY_lower(bbox.optString("bottom")); method.setX_upper(bbox.optString("right")); method.setY_upper(bbox.optString("top")); method.setDistance(params.optString("distance")); } catch (JSONException e) { throw new ServiceException("Method parameters missing."); } return method; }
/** * Parses AGGREGATE method parameters for WPS execute xml variables * * @param lc WFS layer configuration * @param json Method parameters and layer info from the front * @param baseUrl Url for Geoserver WPS reference input (input * @param aggre_field Field name for aggregate function * @return AggregateMethodParams parameters for WPS execution * ********************************************************************** */ private AggregateMethodParams parseAggregateParams( WFSLayerConfiguration lc, JSONObject json, String baseUrl, String aggre_field, List<String> aggre_funcs) throws ServiceException { AggregateMethodParams method = new AggregateMethodParams(); // method.setMethod(AGGREGATE); try { method.setLayer_id(ConversionHelper.getInt(lc.getLayerId(), 0)); method.setServiceUrl(lc.getURL()); baseUrl = baseUrl.replace("&", "&"); method.setHref(baseUrl + String.valueOf(lc.getLayerId())); method.setTypeName(lc.getFeatureNamespace() + ":" + lc.getFeatureElement()); method.setMaxFeatures(String.valueOf(lc.getMaxFeatures())); method.setSrsName(lc.getSRSName()); method.setOutputFormat(DEFAULT_OUTPUT_FORMAT); method.setVersion(lc.getWFSVersion()); method.setXmlns( "xmlns:" + lc.getFeatureNamespace() + "=\"" + lc.getFeatureNamespaceURI() + "\""); method.setGeom(lc.getGMLGeometryProperty()); JSONObject bbox = null; bbox = json.getJSONObject("bbox"); method.setX_lower(bbox.optString("left")); method.setY_lower(bbox.optString("bottom")); method.setX_upper(bbox.optString("right")); method.setY_upper(bbox.optString("top")); // TODO: loop fields - current solution only for 1st field method.setAggreField1(aggre_field); method.setAggreFunctions(aggre_funcs); } catch (JSONException e) { throw new ServiceException("Method parameters missing."); } return method; }