Example #1
0
        public static Byte[] GetMap(MapRequest mapReq)
        {
            string filepath = @"D:\MyDocuments\pkumap\";
            Bitmap tempbmp  = new Bitmap(mapReq.Width, mapReq.Height);

            for (int i = 0; i < mapReq.layers.Length; i++)
            {
                string       filename = filepath + mapReq.layers[i] + ".shp";
                Shapefile    shp      = new Shapefile(filename);
                FeatureClass fc       = shp.GetFeature();
                tempbmp = fc.DrawBMP(mapReq.bbox, tempbmp, mapReq.styles[0]);
            }

            MemoryStream ms = new MemoryStream();

            tempbmp.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
            byte[] bitmapData = new Byte[ms.Length];
            bitmapData = ms.ToArray();
            return(bitmapData);
        }