Send a WMS request to geoserver and display it in Google Earth

Source: Internet
Author: User

You must first install geoserver and publish your local data, or use its own data.

Install Google Earth, create a project, and add the reference earthlib to Google Earth com api in reference. The Code is as follows:

 

 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 );

}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.