protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.DisplayASimpleMap); WorldMapKitOverlay worldMapKitOverlay = new WorldMapKitOverlay(); GeoTiffRasterLayer geoTiffRasterLayer = new GeoTiffRasterLayer(SampleHelper.GetDataPath(@"Tiff/World.tif")); geoTiffRasterLayer.UpperThreshold = double.MaxValue; geoTiffRasterLayer.IsGrayscale = false; geoTiffRasterLayer.LowerThreshold = 0; geoTiffRasterLayer.Open(); LayerOverlay layerOverlay = new LayerOverlay(); layerOverlay.Layers.Add(geoTiffRasterLayer); androidMap = FindViewById <MapView>(Resource.Id.androidmap); androidMap.CurrentExtent = geoTiffRasterLayer.GetBoundingBox(); androidMap.MapUnit = GeographyUnit.DecimalDegree; androidMap.Overlays.Add(worldMapKitOverlay); androidMap.Overlays.Add(layerOverlay); SampleViewHelper.InitializeInstruction(this, FindViewById <RelativeLayout>(Resource.Id.MainLayout), GetType()); }
protected override RasterLayer GetRasterLayer(Uri uri, WorldFileInfo wInfo) { GeoTiffRasterLayer layer = null; if (File.Exists(wInfo.WorldFilePath)) { layer = new GeoTiffRasterLayer(uri.LocalPath, wInfo.WorldFilePath); } else { layer = new GeoTiffRasterLayer(uri.LocalPath); } layer.DrawingExceptionMode = DrawingExceptionMode.DrawException; //if (Environment.OSVersion.Version.Major <= 5) //{ // layer.LibraryType = GeoTiffLibraryType.ManagedLibTiff; //} //else //{ // layer.LibraryType = GeoTiffLibraryType.UnmanagedLibTiff; //} return(layer); }
protected override RasterLayer GetRasterLayer(Uri uri) { GeoTiffRasterLayer layer = null; layer = new GeoTiffRasterLayer(uri.LocalPath); layer.DrawingExceptionMode = DrawingExceptionMode.DrawException; //if (Environment.OSVersion.Version.Major <= 5) //{ // layer.LibraryType = GeoTiffLibraryType.ManagedLibTiff; //} //else //{ // layer.LibraryType = GeoTiffLibraryType.UnmanagedLibTiff; //} return(layer); }
private void LoadAGeoTiffImage_Load(object sender, EventArgs e) { winformsMap1.MapUnit = GeographyUnit.DecimalDegree; winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean); GeoTiffRasterLayer worldImageLayer = new GeoTiffRasterLayer(Samples.RootDirectory + @"Data\world.tif"); worldImageLayer.UpperThreshold = double.MaxValue; worldImageLayer.LowerThreshold = 0; worldImageLayer.IsGrayscale = false; LayerOverlay ImageOverlay = new LayerOverlay(); ImageOverlay.Layers.Add("WorldImageLayer", worldImageLayer); winformsMap1.Overlays.Add(ImageOverlay); winformsMap1.CurrentExtent = new RectangleShape(-118.098, 84.3, 118.098, -84.3); winformsMap1.Refresh(); }
private void Form_Load(object sender, EventArgs e) { // It is important to set the map unit first to either feet, meters or decimal degrees. mapView.MapUnit = GeographyUnit.DecimalDegree; // Create a new overlay that will hold our new layer and add it to the map. LayerOverlay layerOverlay = new LayerOverlay(); mapView.Overlays.Add(layerOverlay); // Create the new layer and dd the layer to the overlay we created earlier. GeoTiffRasterLayer geoTiffRasterLayer = new GeoTiffRasterLayer("../../../Data/GeoTiff/World.tif"); layerOverlay.Layers.Add(geoTiffRasterLayer); // Set the map view current extent to a slightly zoomed in area of the image. mapView.CurrentExtent = new RectangleShape(-90.5399054799761, 68.8866552710533, 57.5181302343096, -43.7137911575181); // Refresh the map. mapView.Refresh(); }
/// <summary> /// Add the GeoTiff layer to the map /// </summary> protected override void OnAppearing() { base.OnAppearing(); // It is important to set the map unit first to either feet, meters or decimal degrees. mapView.MapUnit = GeographyUnit.DecimalDegree; // Create a new overlay that will hold our new layer and add it to the map. LayerOverlay layerOverlay = new LayerOverlay(); mapView.Overlays.Add(layerOverlay); // Create the new layer and dd the layer to the overlay we created earlier. GeoTiffRasterLayer geoTiffRasterLayer = new GeoTiffRasterLayer(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Data/GeoTiff/World.tif")); layerOverlay.Layers.Add(geoTiffRasterLayer); // Set the map view current extent to a slightly zoomed in area of the image. mapView.CurrentExtent = new RectangleShape(-90.5399054799761, 68.8866552710533, 57.5181302343096, -43.7137911575181); // Refresh the map. mapView.Refresh(); }