Inheritance: IArcGISCapabilities
        /// <summary>
        /// Create ArcGisDynamicProvider based on a given capabilities file
        /// </summary>
        /// <param name="url">url to map service example: http://url/arcgis/rest/services/test/MapServer</param>
        /// <param name="arcGisDynamicCapabilities"></param>
        /// <param name="token">token to request service</param>        
        public ArcGISDynamicProvider(string url, ArcGISDynamicCapabilities arcGisDynamicCapabilities, string token = null)
        {
            _timeOut = 10000;
            Token = token;

            Url = url;
            ArcGisDynamicCapabilities = arcGisDynamicCapabilities;
        }
        /// <summary>
        /// Create ArcGisDynamicProvider, capabilities will be parsed automatically
        /// </summary>
        /// <param name="url">url to map service example: http://url/arcgis/rest/services/test/MapServer</param>        
        public ArcGISDynamicProvider(string url)
        {
            Url = url;

            ArcGisDynamicCapabilities = new ArcGISDynamicCapabilities
            {
                fullExtent = new Extent { xmin = 0, xmax = 0, ymin = 0, ymax = 0 },
                initialExtent = new Extent { xmin = 0, xmax = 0, ymin = 0, ymax = 0 }
            };

            var capabilitiesHelper = new CapabilitiesHelper();
            capabilitiesHelper.CapabilitiesReceived += CapabilitiesHelperCapabilitiesReceived;
            capabilitiesHelper.CapabilitiesFailed += CapabilitiesHelperCapabilitiesFailed;
            capabilitiesHelper.GetCapabilities(url, CapabilitiesType.DynamicServiceCapabilities);

            _timeOut = 10000;
        }
Example #3
0
        /// <summary>
        /// Generate BruTile TileSchema based on ArcGIS Capabilities
        /// </summary>
        /// <returns>TileSchema, returns null if service is not tiled</returns>
        public static ITileSchema GetTileSchema(ArcGISDynamicCapabilities arcGisDynamicCapabilities)
        {
            //TODO: Does this belong in Mapsui.Providers?

            if (arcGisDynamicCapabilities.tileInfo == null)
                return null;

            var schema = new TileSchema();
            var count = 0;

            foreach (var lod in arcGisDynamicCapabilities.tileInfo.lods)
            {
                var levelId = count.ToString();
                schema.Resolutions[levelId] = new Resolution { Id = levelId, UnitsPerPixel = lod.resolution };
                count++;
            }

            schema.Height = arcGisDynamicCapabilities.tileInfo.cols;
            schema.Width = arcGisDynamicCapabilities.tileInfo.rows;
            schema.Extent = new BruTile.Extent(arcGisDynamicCapabilities.fullExtent.xmin, arcGisDynamicCapabilities.fullExtent.ymin, arcGisDynamicCapabilities.fullExtent.xmax, arcGisDynamicCapabilities.fullExtent.ymax);
            schema.OriginX = arcGisDynamicCapabilities.tileInfo.origin.x;
            schema.OriginY = arcGisDynamicCapabilities.tileInfo.origin.y;

            schema.Name = "ESRI";
            schema.Format = arcGisDynamicCapabilities.tileInfo.format;
            schema.YAxis = YAxis.OSM;
            schema.Srs = string.Format("EPSG:{0}", arcGisDynamicCapabilities.tileInfo.spatialReference.wkid);

            return schema;
        }
 /// <summary>
 /// Create ArcGisDynamicProvider based on a given capabilities file
 /// </summary>
 /// <param name="url">url to map service example: http://url/arcgis/rest/services/test/MapServer</param>
 /// <param name="arcGisDynamicCapabilities"></param>
 public ArcGISDynamicProvider(string url, ArcGISDynamicCapabilities arcGisDynamicCapabilities)
 {
     Url = url;
     ArcGisDynamicCapabilities = arcGisDynamicCapabilities;
     _timeOut = 10000;            
 }
        private static string GetFormat(ArcGISDynamicCapabilities arcGisDynamicCapabilities)
        {
            //png | png8 | png24 | jpg | pdf | bmp | gif | svg | png32 (png32 only supported from 9.3.1 and up)
            if (arcGisDynamicCapabilities.supportedImageFormatTypes == null)//Not all services return supported types, use png
                return "png";

            var supportedTypes = arcGisDynamicCapabilities.supportedImageFormatTypes.ToLower();

            if (supportedTypes.Contains("png32"))
                return "png32";
            if (supportedTypes.Contains("png24"))
                return "png24";
            if (supportedTypes.Contains("png8"))
                return "png8";
            if (supportedTypes.Contains("png"))
                return "png";

            return "jpg";
        }