gpt4 book ai didi

org.geotools.data.ows.WMSRequest类的使用及代码示例

转载 作者:知者 更新时间:2024-03-21 17:49:05 25 4
gpt4 key购买 nike

本文整理了Java中org.geotools.data.ows.WMSRequest类的一些代码示例,展示了WMSRequest类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WMSRequest类的具体详情如下:
包路径:org.geotools.data.ows.WMSRequest
类名称:WMSRequest

WMSRequest介绍

[英]Available WMS Operations are listed in a Request element.
[中]可用的WMS操作列在请求元素中。

代码示例

代码示例来源:origin: org.geotools/gt-wms

/**
 * Creates a GetFeatureInfoRequest that can be configured and then passed to issueRequest().
 *
 * @param getMapRequest a previous configured GetMapRequest
 * @return a GetFeatureInfoRequest
 * @throws UnsupportedOperationException if the server does not support GetFeatureInfo
 */
public GetFeatureInfoRequest createGetFeatureInfoRequest(GetMapRequest getMapRequest) {
  if (getCapabilities().getRequest().getGetFeatureInfo() == null) {
    throw new UnsupportedOperationException(
        "This Web Map Server does not support GetFeatureInfo requests");
  }
  URL onlineResource = findURL(getCapabilities().getRequest().getGetFeatureInfo());
  GetFeatureInfoRequest request =
      getSpecification().createGetFeatureInfoRequest(onlineResource, getMapRequest);
  return request;
}

代码示例来源:origin: org.geotools/gt-wms

public WMSCoverageReader(WebMapServer wms, Layer layer, String style) {
  this.wms = wms;
  // init the reader
  addLayer(layer, style);
  // best guess at the format with a preference for PNG (since it's normally transparent)
  List<String> formats = wms.getCapabilities().getRequest().getGetMap().getFormats();
  this.format = formats.iterator().next();
  for (String format : formats) {
    if ("image/png".equals(format)
        || "image/png24".equals(format)
        || "png".equals(format)
        || "png24".equals(format)
        || "image/png; mode=24bit".equals(format)) {
      this.format = format;
      break;
    }
  }
}

代码示例来源:origin: org.geotools/gt2-wms

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 *    
 * @generated modifiable
 */	
public Object parse(ElementInstance instance, Node node, Object value) 
  throws Exception {
  WMSRequest ret = new WMSRequest();
  ret.setGetCapabilities((OperationType)node.getChildValue("GetCapabilities"));
  ret.setDescribeLayer((OperationType)node.getChildValue("DescribeLayer"));
  ret.setGetFeatureInfo((OperationType)node.getChildValue("GetFeatureInfo"));
  ret.setGetLegendGraphic((OperationType)node.getChildValue("GetLegendGraphic"));
  ret.setGetMap((OperationType)node.getChildValue("GetMap"));
  ret.setGetStyles((OperationType)node.getChildValue("GetStyles"));
  ret.setPutStyles((OperationType)node.getChildValue("PutStyles"));
  return ret;
}

代码示例来源:origin: org.geowebcache/gwc-wms

/**
 * Finds URL to WMS service and attempts to slice away the service parameter, since we will add
 * that anyway.
 * 
 * @param wms
 * @return
 */
private String getWMSUrl(WebMapServer wms) {
  // // http://sigma.openplans.org:8080/geoserver/wms?SERVICE=WMS&
  String wmsUrl = wms.getCapabilities().getRequest().getGetCapabilities().getGet().toString();
  int queryStart = wmsUrl.lastIndexOf("?");
  if (queryStart > 0) {
    String preQuery = wmsUrl.substring(queryStart);
    if (preQuery.equalsIgnoreCase("?service=wms&")) {
      wmsUrl = wmsUrl.substring(0, wmsUrl.lastIndexOf("?"));
    }
  }
  return wmsUrl;
}

代码示例来源:origin: org.geotools/gt2-wms

public GetLegendGraphicRequest createGetLegendGraphicRequest() throws UnsupportedOperationException {
  if (getCapabilities().getRequest().getGetLegendGraphic() == null) {
    throw new UnsupportedOperationException("Server does not specify a GetLegendGraphic operation. Cannot be performed");
  }
  
  URL onlineResource = getCapabilities().getRequest().getGetLegendGraphic().getGet();
  if (onlineResource == null) {
    onlineResource = serverURL;
  }
  
  GetLegendGraphicRequest request = getSpecification().createGetLegendGraphicRequest(onlineResource);
  
  return request;        
}

代码示例来源:origin: org.geotools/gt2-wms

public DescribeLayerRequest createDescribeLayerRequest() throws UnsupportedOperationException {
  if (getCapabilities().getRequest().getDescribeLayer() == null ) {
    throw new UnsupportedOperationException("Server does not specify a DescribeLayer operation. Cannot be performed");
  }
  
  URL onlineResource = getCapabilities().getRequest().getDescribeLayer().getGet();
  if (onlineResource == null) {
    onlineResource = serverURL;
  }
  
  DescribeLayerRequest request = getSpecification().createDescribeLayerRequest(onlineResource);
  
  return request;
}

代码示例来源:origin: org.geotools/gt-wms

public GetStylesRequest createGetStylesRequest() throws UnsupportedOperationException {
  if (getCapabilities().getRequest().getGetStyles() == null) {
    throw new UnsupportedOperationException(
        "Server does not specify a GetStyles operation. Cannot be performed");
  }
  URL onlineResource = getCapabilities().getRequest().getGetStyles().getGet();
  if (onlineResource == null) {
    onlineResource = serverURL;
  }
  GetStylesRequest request = getSpecification().createGetStylesRequest(onlineResource);
  return request;
}

代码示例来源:origin: org.geotools/gt-wms

public PutStylesRequest createPutStylesRequest() throws UnsupportedOperationException {
  if (getCapabilities().getRequest().getPutStyles() == null) {
    throw new UnsupportedOperationException(
        "Server does not specify a PutStyles operation. Cannot be performed");
  }
  URL onlineResource = getCapabilities().getRequest().getPutStyles().getGet();
  if (onlineResource == null) {
    onlineResource = serverURL;
  }
  PutStylesRequest request = getSpecification().createPutStylesRequest(onlineResource);
  return request;
}

代码示例来源:origin: org.geotools/gt-wms

/**
 * Creates a new WebMapServer from a WMSCapablitiles document.
 *
 * <p>The implementation assumes that the server is located at:
 * capabilities.getRequest().getGetCapabilities().getGet()
 *
 * @param capabilities
 * @throws IOException
 * @throws ServiceException
 */
public WebMapServer(WMSCapabilities capabilities) throws IOException, ServiceException {
  super(capabilities, capabilities.getRequest().getGetCapabilities().getGet());
}

代码示例来源:origin: org.geotools/gt-wms

public GetLegendGraphicRequest createGetLegendGraphicRequest()
    throws UnsupportedOperationException {
  if (getCapabilities().getRequest().getGetLegendGraphic() == null) {
    throw new UnsupportedOperationException(
        "Server does not specify a GetLegendGraphic operation. Cannot be performed");
  }
  URL onlineResource = getCapabilities().getRequest().getGetLegendGraphic().getGet();
  if (onlineResource == null) {
    onlineResource = serverURL;
  }
  GetLegendGraphicRequest request =
      getSpecification().createGetLegendGraphicRequest(onlineResource);
  return request;
}

代码示例来源:origin: org.geotools/gt-wms

public DescribeLayerRequest createDescribeLayerRequest() throws UnsupportedOperationException {
  if (getCapabilities().getRequest().getDescribeLayer() == null) {
    throw new UnsupportedOperationException(
        "Server does not specify a DescribeLayer operation. Cannot be performed");
  }
  URL onlineResource = getCapabilities().getRequest().getDescribeLayer().getGet();
  if (onlineResource == null) {
    onlineResource = serverURL;
  }
  DescribeLayerRequest request =
      getSpecification().createDescribeLayerRequest(onlineResource);
  return request;
}

代码示例来源:origin: org.geotools/gt2-wms

public GetStylesRequest createGetStylesRequest() throws UnsupportedOperationException{
  if (getCapabilities().getRequest().getGetStyles() == null) {
    throw new UnsupportedOperationException("Server does not specify a GetStyles operation. Cannot be performed");
  }
  
  URL onlineResource = getCapabilities().getRequest().getGetStyles().getGet();
  if (onlineResource == null) {
    onlineResource = serverURL;
  }
  
  GetStylesRequest request = getSpecification().createGetStylesRequest(onlineResource);
    return request;
}

代码示例来源:origin: org.geotools/gt2-wms

public PutStylesRequest createPutStylesRequest() throws UnsupportedOperationException {
  if (getCapabilities().getRequest().getPutStyles() == null) {
    throw new UnsupportedOperationException("Server does not specify a PutStyles operation. Cannot be performed");
  }
  
  URL onlineResource = getCapabilities().getRequest().getPutStyles().getGet();
  if (onlineResource == null) {
    onlineResource = serverURL;
  }
  
  PutStylesRequest request = getSpecification().createPutStylesRequest(onlineResource);
  return request;
}

代码示例来源:origin: org.geotools/gt2-wms

OperationNotSupportedException {
WMSRequest request = new WMSRequest();
    request.setGetCapabilities((WMSOperationType) value[i]
        .getValue());
    request.setGetMap((WMSOperationType) value[i].getValue());
    request.setGetFeatureInfo((WMSOperationType) value[i]
        .getValue());
    request.setDescribeLayer((WMSOperationType) value[i]
        .getValue());
    request.setGetLegendGraphic((WMSOperationType) value[i]
        .getValue());
        .setGetStyles((WMSOperationType) value[i]
            .getValue());
        .setPutStyles((WMSOperationType) value[i]
            .getValue());

代码示例来源:origin: org.geotools/gt2-wms

/**
 * Creates a GetFeatureInfoRequest that can be configured and then passed to
 * issueRequest(). 
 * 
 * @param getMapRequest a previous configured GetMapRequest
 * @return a GetFeatureInfoRequest
 * @throws UnsupportedOperationException if the server does not support GetFeatureInfo
 */
public GetFeatureInfoRequest createGetFeatureInfoRequest( GetMapRequest getMapRequest ) {
  if (getCapabilities().getRequest().getGetFeatureInfo() == null) {
    throw new UnsupportedOperationException("This Web Map Server does not support GetFeatureInfo requests");
  }
  URL onlineResource = findURL(getCapabilities().getRequest().getGetFeatureInfo());
  
  GetFeatureInfoRequest request = getSpecification().createGetFeatureInfoRequest(onlineResource,
      getMapRequest);
  return request;
}

代码示例来源:origin: org.geotools/gt2-wms

public GeneralParameterDescriptor createFormatReadParam() {
  Map properties = fillProperties("FORMAT",
      "Value contains the desired format");
  GeneralParameterDescriptor param = new DefaultParameterDescriptor(properties,
      String.class,
      capabilities.getRequest().getGetMap().getFormats().toArray(new String[capabilities.getRequest().getGetMap().getFormats().size()]), null,
      null, null, null, true);
  return param;
}

代码示例来源:origin: org.geotools/gt-wms

/**
 * The source of this WMS is the capabilities document.
 *
 * <p>We make an effort here to look in the capabilities document provided for the
 * unambiguous capabilities URI. This covers the case where the capabilities document has
 * been cached on disk and we are restoring a WebMapServer instance.
 */
public URI getSource() {
  try {
    URL source = getCapabilities().getRequest().getGetCapabilities().getGet();
    return source.toURI();
  } catch (NullPointerException huh) {
  } catch (URISyntaxException e) {
  }
  try {
    return serverURL.toURI();
  } catch (URISyntaxException e) {
    return null;
  }
}

代码示例来源:origin: org.geotools/gt-wms

getCapabilities().getRequest().getGetLegendGraphic();
if (getLegendGraphic == null) {

代码示例来源:origin: org.geotools/gt-wms

public Object getValue(Element element, ElementValue[] value, Attributes attrs, Map hints)
    throws SAXException, OperationNotSupportedException {
  WMSRequest request = new WMSRequest();
      request.setGetCapabilities(
          (org.geotools.data.ows.OperationType) value[i].getValue());
      request.setGetMap((org.geotools.data.ows.OperationType) value[i].getValue());
      request.setGetFeatureInfo(
          (org.geotools.data.ows.OperationType) value[i].getValue());
      request.setDescribeLayer(
          (org.geotools.data.ows.OperationType) value[i].getValue());
      request.setGetLegendGraphic(
          (org.geotools.data.ows.OperationType) value[i].getValue());
      request.setGetStyles((org.geotools.data.ows.OperationType) value[i].getValue());
      request.setPutStyles((org.geotools.data.ows.OperationType) value[i].getValue());

代码示例来源:origin: org.geoserver/gs-wms

/** 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;
      }
    } else if (layer.getResource() instanceof WMTSLayerInfo) {
      return false;
    }
    return layer.isQueryable();
  } catch (IOException e) {
    LOGGER.log(
        Level.INFO,
        "Failed to determine if the layer is queryable, assuming it's not",
        e);
    return false;
  }
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com