public void Apply(string intermediatePath) { //tergetURL = "http://secure.futureclimateinfo.com/api/wms?request=GetMap&BBOX=314100,543800,314600,544300&SRS=EPSG:27700&WIDTH=1056&HEIGHT=1056&LAYERS=nls-sixinch&STYLES=&FORMAT=image/png"; //tergetURL = "http://secure.futureclimateinfo.com/api/wms?SERVICE=WMS&VERSION=1.1.1&request=GetMap&BBOX=314100,543800,314600,544300&SRS=EPSG:27700&WIDTH=1056&HEIGHT=1056&LAYERS=nls-sixinch&STYLES=&FORMAT=image/pnG"; //tergetURL = "http://secure.futureclimateinfo.com/api/wms?request=GetMap&BBOX=589400,194000,589900,194500&SRS=EPSG:27700&WIDTH=1056&HEIGHT=1056&LAYERS=nls-sixinch&STYLES=&FORMAT=image/png"; //tergetURL = "http://secure.futureclimateinfo.com/api/wms?request=GetMap&BBOX=589400,194000,590400,195000&SRS=EPSG:27700&WIDTH=947&HEIGHT=947&LAYERS=nls-sixinch&STYLES=&FORMAT=image/pnG"; //MapServerParameters.targetURL = "http://secure.futureclimateinfo.com/api/wms?&&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&BBOX=597528,209822,598528,210822&SRS=EPSG:27700&WIDTH=1500&HEIGHT=1500&LAYERS=nls-sixinch:&STYLES=&FORMAT=image/png&DPI=96&MAP_RESOLUTION=96&FORMAT_OPTIONS=dpi:96&TRANSP... Bitmap SourceImage = ConnectToMapServer.ConnectToWMS(MapServerParameters.targetURL); SourceImage.Save(intermediatePath + StraboParameters.sourceMapFileName); ColorHistogram ch = new ColorHistogram(); if (!ch.CheckImageColors(SourceImage, 2)) { Exception e = new Exception("The returned image is invalid, it has less than two colors."); Log.WriteLine("The returned image is invalid, it has less than two colors."); throw e; } }
public Tile Apply(string intermediatePath, string output_file_name) { double mapWestCorner = double.Parse(MapServerParameters.BBOXW); double mapNorthCorner = double.Parse(MapServerParameters.BBOXN); string wmsMapPath = intermediatePath + output_file_name; int layer = MapServerParameters.ZoomLevel; Bitmap SourceImage = GetImage(mapWestCorner, mapNorthCorner, intermediatePath); SourceImage.Save(wmsMapPath); ColorHistogram ch = new ColorHistogram(); if (!ch.CheckImageColors(SourceImage, 2)) { SourceImage.Dispose(); Exception e = new Exception("The returned image is invalid, it has less than two colors."); Log.WriteLine("The returned image is invalid, it has less than two colors."); throw e; } SourceImage.Dispose(); return(_tile); }