private List <GdalRasterLayer> LoadGeoReferencedImages() { List <GdalRasterLayer> layers = new List <GdalRasterLayer>(); string[] files = Directory.GetFiles(Properties.MappingSettings.Default.CustomMapPath, "*.tif", SearchOption.TopDirectoryOnly); foreach (string filename in files) { GdalRasterLayer layer = new GdalRasterLayer(filename, filename); layers.Add(layer); mapBox1.Map.Layers.Add(layer); } return(layers); }
public static ITheme GenerateDefaultThemeFromFile(GdalRasterLayer layer) { if (!(layer.DataSource is GdalFeatureProvider)) { return(null); } string filename = (layer.DataSource as GdalFeatureProvider).Path; ITheme theme = null; if (filename != null) { theme = ConvertLegendToTheme(filename, layer.Grid.Components[0].Name, layer.Grid); } return(theme); }
public void RenderBilFile() { Debug.WriteLine(Directory.GetCurrentDirectory()); var map = new Map(new Size(400, 200)) { Name = "map1" }; //string fileName = @"..\..\..\..\data\RasterData\SchematisatieInt.bil"; string fileName = RasterDataPath + "bodem.bil"; //string fileName = @"..\..\..\..\data\wsiearth.tif"; var rasterLayer = new GdalRasterLayer(fileName); rasterLayer.CustomRenderers.Add(new GdalRenderer(rasterLayer)); // add optimized custom gdal renderer map.Layers.Add(rasterLayer); MapTestHelper.Show(map); }
public void GdalRendererShouldRenderBilFileWithDefaultTheme() { const string rasterPath = @"..\..\..\..\..\test-data\DeltaShell\DeltaShell.Plugins.SharpMapGis.Tests\RasterData\"; const string path = rasterPath + "Schematisatie.bil"; Assert.IsTrue(File.Exists(path)); var rasterLayer = new GdalRasterLayer(); var rasterFeatureProvider = new GdalFeatureProvider { Path = path }; rasterLayer.CustomRenderers.Add(new GdalRenderer(rasterLayer)); // add optimized custom gdal renderer rasterLayer.DataSource = rasterFeatureProvider; Map map = new Map(new Size(200, 200)); map.Layers.Add(rasterLayer); MapTestHelper.Show(map); }
public static Map InitializeMapGdal(Size size) { HttpContext.Current.Trace.Write("Initializing map..."); //Initialize a new map of size 'imagesize' Map map = new Map(size); //Set up the gdal layer LayerGroup g = new LayerGroup("OS"); g.SRID = 27700; //D:\Raster\Ordnance Survey\OS Street View SM\data\sm DirectoryInfo di = new DirectoryInfo(HttpContext.Current.Server.MapPath(@"~\App_Data\Gdal")); foreach (FileInfo fi in di.GetFiles("*.tif")) { try { GdalRasterLayer layer = new GdalRasterLayer( fi.Name, HttpContext.Current.Server.MapPath(@"~\App_Data\Gdal\" + fi.Name)); //layer.SRID = 27700; g.Layers.Add(layer); } catch (TypeInitializationException ex) { if (ex.GetType() == typeof(TypeInitializationException)) { throw new Exception( "Please copy the umanaged dll's into your bin folder from javascript:window.location.href='http://www.codeplex.com/SharpMap/Wiki/View.aspx?title=Extensions';."); } } } map.Layers.Add(g); map.ZoomToExtents(); HttpContext.Current.Trace.Write("Map initialized"); return(map); }
public void RenderBilFile() { Debug.WriteLine(Directory.GetCurrentDirectory()); var map = new Map(new Size(400, 200)) {Name = "map1"}; //string fileName = @"..\..\..\..\data\RasterData\SchematisatieInt.bil"; string fileName = RasterDataPath + "bodem.bil"; //string fileName = @"..\..\..\..\data\wsiearth.tif"; var rasterLayer = new GdalRasterLayer(fileName); rasterLayer.CustomRenderers.Add(new GdalRenderer(rasterLayer)); // add optimized custom gdal renderer map.Layers.Add(rasterLayer); MapTestHelper.ShowModal(map); }
public GdalRasterLayerCachingProxy(string strLayerName, string imageFilename) { LayerName = strLayerName; _innerLayer = new GdalRasterLayer(strLayerName, imageFilename); }
public GdalRasterLayerCachingProxy(GdalRasterLayer innerLayer) { _innerLayer = innerLayer; LayerName = innerLayer.LayerName; }