Exemplo n.º 1
0
  /**
   * 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;
  }