Web Map Service layer
The WmsLayer is currently very basic and doesn't support automatic fetching of the WMS Service Description. Instead you would have to add the nessesary parameters to the URL, and the WmsLayer will set the remaining BoundingBox property and proper requests that changes between the requests. See the example below.
상속: IProjectingProvider
예제 #1
0
        /// <summary>
        /// Initializes a new layer, and downloads and parses the service description
        /// </summary>
        /// <param name="url">Url of WMS server</param>
        /// <param name="persistentCache"></param>
        /// <param name="wmsVersion">Version number of wms leave null to get the default service version</param>
        /// <param name="getStreamAsync">Download method, leave null for default</param>
        public static async Task <WmsProvider> CreateAsync(string url, string?wmsVersion = null, Func <string, Task <Stream> >?getStreamAsync = null, IUrlPersistentCache?persistentCache = null)
        {
            var client = await Client.CreateAsync(url, wmsVersion, getStreamAsync, persistentCache : persistentCache);

            var provider = new WmsProvider(client, persistentCache: persistentCache);

            provider.InitialiseGetStreamAsyncMethod(getStreamAsync);
            return(provider);
        }
예제 #2
0
        private static WmsProvider CreateWmsProvider()
        {
            const string wmsUrl = "http://geoserver.nl/world/mapserv.cgi?map=world/world.map&VERSION=1.1.1";

            var provider = new WmsProvider(wmsUrl);
            provider.SpatialReferenceSystem = "EPSG:900913";
            provider.AddLayer("World");
            provider.SetImageFormat(provider.OutputFormats[0]);
            provider.ContinueOnError = true;
            provider.TimeOut = 20000; //Set timeout to 20 seconds
            return provider;
        }
예제 #3
0
        private static WmsProvider CreateWmsProvider()
        {
            const string wmsUrl = "http://geodata.nationaalgeoregister.nl/ahn25m/wms?service=wms&request=getcapabilities";

            var provider = new WmsProvider(wmsUrl)
            {
                ContinueOnError = true,
                TimeOut = 2000,
                CRS = "EPSG:28992"
            };

            provider.AddLayer("ahn25m");
            provider.SetImageFormat(provider.OutputFormats[0]);
            return provider;
        }
예제 #4
0
        public void GetLegendRequestUrls_WhenInitialized_ShouldReturnListOfUrls()
        {
            // arrange
            var capabilties = new XmlDocument { XmlResolver = null };
            capabilties.Load($"{AssemblyInfo.AssemblyDirectory}\\Resources\\capabilities_1_3_0.xml");
            var provider = new WmsProvider(capabilties) { CRS = "EPSG:3857" };
            provider.AddLayer("Maasluis complex - top");
            provider.AddLayer("Kreftenheye z2 - top");
            provider.SetImageFormat(provider.OutputFormats[0]);
            provider.ContinueOnError = true;

            // act
            var legendUrls = provider.GetLegendRequestUrls();

            // assert
            Assert.True(legendUrls.Count() == 2);
        }
예제 #5
0
        public void GetLegendRequestUrls_WhenInitialized_ShouldReturnListOfUrls()
        {
            // arrange
            var capabilties = new XmlDocument();
            capabilties.XmlResolver = null;
            capabilties.Load(".\\Resources\\capabilities_1_3_0.xml");
            var provider = new WmsProvider(capabilties);
            provider.SpatialReferenceSystem = "EPSG:900913";
            provider.AddLayer("Maasluis complex - top");
            provider.AddLayer("Kreftenheye z2 - top");
            provider.SetImageFormat(provider.OutputFormats[0]);
            provider.ContinueOnError = true;

            // act
            var legendUrls = provider.GetLegendRequestUrls();

            // assert
            Assert.True(legendUrls.Count() == 2);
        }