SuperMap.Connector.Map.GetTile C# (CSharp) Method

GetTile() public method

根据地图分块信息,获取格网图片。
public GetTile ( string mapName, TileInfo tileInfo, ImageOutputOption imageOutputOption ) : MapImage
mapName string 地图名称。
tileInfo SuperMap.Connector.Utility.TileInfo 地图分块信息。
imageOutputOption SuperMap.Connector.Utility.ImageOutputOption 图片输出设置。
return SuperMap.Connector.Utility.MapImage
        public MapImage GetTile(string mapName, TileInfo tileInfo, ImageOutputOption imageOutputOption)
        {
            return _mapProvider.GetTile(mapName, tileInfo, imageOutputOption);
        }

Same methods

Map::GetTile ( string mapName, TileInfo tileInfo, ImageOutputOption imageOutputOption, MapParameter mapParameter ) : MapImage

Usage Example

コード例 #1
0
        public void GetTileTest_ByTempLayer()
        {
            Map map = new Map("http://" + ip + ":8090/iserver/services/map-world/rest");

            TileInfo tileInfo = new TileInfo();
            tileInfo.Scale = 0.00000002;
            tileInfo.Height = 512;
            tileInfo.Width = 512;
            TileIndex tileIndex = new TileIndex() { RowIndex = 2, ColIndex = 1 };
            tileInfo.TileIndex = tileIndex;

            MapParameter mapParameter = map.GetDefaultMapParameter("世界地图");

            List<Layer> tempLayer = new List<Layer>();
            tempLayer.Add(mapParameter.Layers[12]);
            mapParameter.Layers = tempLayer;

            ImageOutputOption imageOutputOption = new ImageOutputOption();
            imageOutputOption.ImageReturnType = ImageReturnType.BINARY;
            imageOutputOption.Transparent = false;
            imageOutputOption.ImageOutputFormat = ImageOutputFormat.PNG;

            MapImage mapImage = map.GetTile("世界地图", tileInfo, imageOutputOption, mapParameter);
            using (MemoryStream memoryStream = new MemoryStream(mapImage.ImageData))
            {
                Bitmap bmp = new Bitmap(memoryStream);
                Assert.IsTrue(bmp.Width == 512);
                Assert.IsTrue(bmp.Height == 512);
                System.Drawing.Color color = bmp.GetPixel(240, 389);
                Assert.IsTrue(color.R == 242);
                Assert.IsTrue(color.G == 239);
                Assert.IsTrue(color.B == 233);
            }

            Assert.IsNull(null);
        }
All Usage Examples Of SuperMap.Connector.Map::GetTile