예제 #1
0
        private void CreateMap()
        {
            string basePath = Server.MapPath(@"~\Shape");

            WebMap1.Projection     = KnownCoordinateSystems.Projected.World.WebMercator;
            WebMap1.MapViewExtents = new Extent(-20037508.342789, -20037508.342789, 20037508.342789, 20037508.342789);


            WebMapClient client = new WebMapClient();


            WMTClient wmt1 = new WMTClient();

            wmt1.Create(WebServiceType.BingHybrid);


            string    WMSServerWMS0 = "http://maps.ngdc.noaa.gov/soap/web_mercator/marine_geology/MapServer/WMSServer";
            WMSClient wms0          = new WMSClient();

            wms0.ReadCapabilities(WMSServerWMS0);
            wms0.CRS        = "EPSG:3857";
            wms0.Projection = KnownCoordinateSystems.Projected.World.WebMercator;


            string WMSServerWMS1 = "http://maps.ngdc.noaa.gov/soap/web_mercator/graticule/MapServer/WMSServer";

            WMSClient wms1 = new WMSClient();

            wms1.ReadCapabilities(WMSServerWMS1);
            wms1.CRS        = "EPSG:3857";
            wms1.Projection = KnownCoordinateSystems.Projected.World.WebMercator;


            client.AddService(wmt1);
            client.AddService(wms0);
            client.AddService(wms1);

            WebMap1.Back = client;


            IMapFeatureLayer  countriesLayer = (IMapFeatureLayer)WebMap1.AddLayer(basePath + @"\10m_admin_0_countries.shp");
            PolygonSymbolizer symbCountries  = new PolygonSymbolizer(Color.FromArgb(0, 191, 0));

            symbCountries.SetFillColor(Color.Transparent);
            symbCountries.OutlineSymbolizer = new LineSymbolizer(Color.Magenta, 1);
            countriesLayer.Symbolizer       = symbCountries;


            IMapFeatureLayer graticules30Layer = (IMapFeatureLayer)WebMap1.AddLayer(basePath + @"\10m_graticules_30.shp");
            LineSymbolizer   symbGratitules30  = new LineSymbolizer(Color.Red, 1);

            graticules30Layer.Symbolizer = symbGratitules30;

            graticules30Layer.IsVisible = false;
        }
예제 #2
0
        private void btnGetCapabilities_Click(object sender, EventArgs e)
        {
            var serverUrl = tbServerUrl.Text;

            var wmsClient = new WMSClient();

            wmsClient.ReadCapabilities(serverUrl);
            WmsServerInfo.Version        = wmsClient.Version;
            WmsServerInfo.OnlineResource = wmsClient.ServiceDescription.OnlineResource;

            var layers = wmsClient.GetVisibleLayer();

            dgvLayers.DataSource = layers;
        }