/**
   * 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;
  }