zoukankan      html  css  js  c++  java
  • 向geoserver发送wms服务请求,并在google earth中显示

      首先需要安装geoserver,并且发布了自己的本地数据,或者用它自带的数据也行。

      安装google earth,新建项目,在引用中添加对google earth com api的引用EARTHLib,代码如下:

    private void someevent(object sender, EventArgs e)
    {
    string uri = "http://localhost:8888/geoserver/wms?bbox=-130,24,-66,50&styles=population&Format=kml&request=GetMap&layers=topp:states&width=550&height=250&srs=EPSG:4326";
    System.Net.WebRequest wr
    = System.Net.WebRequest.Create(uri);
    IApplicationGE wmsget
    = appGE as IApplicationGE;

    using (System.Net.WebResponse response = wr.GetResponse())
    {
    Encoding encode
    = System.Text.Encoding.GetEncoding("utf-8");
    StreamReader readStream
    = new StreamReader(response.GetResponseStream(), encode);
    string kml = readStream.ReadToEnd();
    wmsget.LoadKmlData(
    ref kml);

    }
    }

  • 相关阅读:
    python时间类型相关
    python调用函数
    LightGBM
    保存训练好的模型并调用
    Bootstrap Table
    Jquery 获取元素上绑定的事件
    C# DLL 反编译改代码
    FastReport C# 导出
    Log4Net
    BootStrap Table
  • 原文地址:https://www.cnblogs.com/myparamita/p/1740973.html
Copyright © 2011-2022 走看看