public static TileMapService CreateFromResource(Stream result)
        {
            var tileMapService = new TileMapService();

            XDocument xml = XDocument.Parse(new StreamReader(result).ReadToEnd());

            tileMapService.TileMaps =
                from tileMap in xml.Root.Descendants("TileMap")
                select new TileMapItem
                {
                    Href = tileMap.Attribute("href").Value,
                    Srs = tileMap.Attribute("srs").Value,
                    Title = tileMap.Attribute("title").Value,
                    Profile = tileMap.Attribute("profile").Value
                };

            return tileMapService;
        }
Esempio n. 2
0
        public static TileMapService CreateFromResource(Stream result)
        {
            var tileMapService = new TileMapService();

            XDocument xml = XDocument.Parse(new StreamReader(result).ReadToEnd());

            tileMapService.TileMaps =
                from tileMap in xml.Root.Descendants("TileMap")
                select new TileMapItem
            {
                Href    = tileMap.Attribute("href").Value,
                Srs     = tileMap.Attribute("srs").Value,
                Title   = tileMap.Attribute("title").Value,
                Profile = tileMap.Attribute("profile").Value
            };

            return(tileMapService);
        }
Esempio n. 3
0
        public static TileMapService CreateFromResource(Stream result)
        {
            var tileMapService = new TileMapService();

            XDocument xml = XDocument.Parse(new StreamReader(result).ReadToEnd());

            if (xml.Root == null)
            {
                throw new XmlException("TMS xml root is null");
            }

            tileMapService.TileMaps = xml.Root.Descendants("TileMap").Select(tileMap => new TileMapItem
            {
                Href    = tileMap.Attribute("href")?.Value,
                Srs     = tileMap.Attribute("srs")?.Value,
                Title   = tileMap.Attribute("title")?.Value,
                Profile = tileMap.Attribute("profile")?.Value
            });

            return(tileMapService);
        }