/** * Parses INTERSECT 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 IntersectMethodParams parameters for WPS execution * ********************************************************************** */ private IntersectMethodParams parseIntersectParams( WFSLayerConfiguration lc, WFSLayerConfiguration lc2, JSONObject json, String baseUrl) throws ServiceException { IntersectMethodParams method = new IntersectMethodParams(); // method.setMethod(INTERSECT); // 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.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()); // Variable values of Union input 2 method.setHref2(baseUrl + String.valueOf(lc2.getLayerId())); method.setTypeName2(lc2.getFeatureNamespace() + ":" + lc2.getFeatureElement()); method.setXmlns2( "xmlns:" + lc2.getFeatureNamespace() + "=\"" + lc2.getFeatureNamespaceURI() + "\""); method.setGeom2(lc2.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")); // TODO: Intersect retain columns // A layer // method.setFieldA1(fieldA1); // B layer // method.setFieldA1(fieldB1); } 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; }