Beispiel #1
0
        private IActionResult ProcessGetCapabilitiesRequest(Wms.Version version)
        {
            var layers = U.EntitiesConverter.SourcesToLayers(this.tileSourceFabric.Sources)
                         .Where(l => l.Srs == U.SrsCodes.EPSG3857)                                  // TODO: EPSG:4326 support
                         .Where(l => l.Format == ImageFormats.Png || l.Format == ImageFormats.Jpeg) // Only raster formats
                         .Select(l => new Layer
            {
                Name               = l.Identifier,
                Title              = String.IsNullOrEmpty(l.Title) ? l.Identifier : l.Title,
                Abstract           = l.Abstract,
                IsQueryable        = false,
                GeographicalBounds = l.GeographicalBounds,
            })
                         .ToList();

            var xmlDoc = new CapabilitiesUtility(BaseUrl + "/wms").CreateCapabilitiesDocument(
                version,
                new Wms.ServiceProperties
            {
                Title    = this.tileSourceFabric.ServiceProperties.Title,
                Abstract = this.tileSourceFabric.ServiceProperties.Abstract,
                Keywords = this.tileSourceFabric.ServiceProperties.KeywordsList,
            },
                layers,
                new[]
            {
                MediaTypeNames.Image.Png,
                MediaTypeNames.Image.Jpeg,
                MediaTypeNames.Image.Tiff,
            });

            return(File(U.EntitiesConverter.ToUTF8ByteArray(xmlDoc), MediaTypeNames.Text.Xml));
        }
Beispiel #2
0
        private IActionResult ProcessGetCapabilitiesRequest()
        {
            var layers = EntitiesConverter.SourcesToLayers(this.tileSourceFabric.Sources)
                         .Where(l => l.Format == ImageFormats.Png || l.Format == ImageFormats.Jpeg) // Only raster formats
                         .ToList();

            var xmlDoc = new CapabilitiesUtility(
                new Wmts.ServiceProperties
            {
                Title    = this.tileSourceFabric.ServiceProperties.Title,
                Abstract = this.tileSourceFabric.ServiceProperties.Abstract,
                Keywords = this.tileSourceFabric.ServiceProperties.KeywordsList,
            },
                BaseUrl + "/wmts",
                layers)
                         .GetCapabilities(); // TODO: fix base URL

            return(File(xmlDoc.ToUTF8ByteArray(), MediaTypeNames.Text.Xml));
        }