Exemple #1
0
  /** Returns true if the layer can be queried */
  public boolean isQueryable(LayerInfo layer) {
    try {
      if (layer.getResource() instanceof WMSLayerInfo) {
        WMSLayerInfo info = (WMSLayerInfo) layer.getResource();
        Layer wl = info.getWMSLayer(null);
        if (!wl.isQueryable()) {
          return false;
        }
        WMSCapabilities caps = info.getStore().getWebMapServer(null).getCapabilities();
        OperationType featureInfo = caps.getRequest().getGetFeatureInfo();
        if (featureInfo == null || !featureInfo.getFormats().contains("application/vnd.ogc.gml")) {
          return false;
        }
      }

      return layer.isQueryable();

    } catch (IOException e) {
      LOGGER.log(Level.INFO, "Failed to determin if the layer is queryable, assuming it's not", e);
      return false;
    }
  }