private async void Initialize() { // Apply an imagery basemap to the map. MyMapView.Map = new Map(Basemap.CreateImagery()); // Create a new WMS layer displaying the specified layers from the service. _wmsLayer = new WmsLayer(_wmsUrl, _wmsLayerNames); try { // Load the layer. await _wmsLayer.LoadAsync(); // Add the layer to the map. MyMapView.Map.OperationalLayers.Add(_wmsLayer); // Zoom to the layer's extent. MyMapView.SetViewpoint(new Viewpoint(_wmsLayer.FullExtent)); // Subscribe to tap events - starting point for feature identification. MyMapView.GeoViewTapped += MyMapView_GeoViewTapped; } catch (Exception e) { await new MessageDialog(e.ToString(), "Error").ShowAsync(); } }
private async void InitializeAsync() { try { // Create a map with spatial reference appropriate for the service. Map myMap = new Map(SpatialReference.Create(26915)) { MinScale = 7000000.0 }; // Create a new WMS layer displaying the specified layers from the service. // The default styles are chosen by default. _mnWmsLayer = new WmsLayer(_wmsUrl, _wmsLayerNames); // Wait for the layer to load. await _mnWmsLayer.LoadAsync(); // Center the map on the layer's contents. myMap.InitialViewpoint = new Viewpoint(_mnWmsLayer.FullExtent); // Add the layer to the map. myMap.OperationalLayers.Add(_mnWmsLayer); // Add the map to the view. MyMapView.Map = myMap; // Enable the buttons. FirstStyleButton.IsEnabled = true; SecondStyleButton.IsEnabled = true; } catch (Exception ex) { await Application.Current.MainPage.DisplayAlert("Error", ex.ToString(), "OK"); } }
public bool AddWMSLayer(string baseUrl, string layers, string name, Extents extents, int Epsg, string Format) { WmsLayer wmsLayer = new WmsLayer(); wmsLayer.BaseUrl = baseUrl; wmsLayer.BoundingBox = extents; wmsLayer.DoCaching = false; wmsLayer.Epsg = Epsg; wmsLayer.Format = Format; wmsLayer.Layers = layers; wmsLayer.Name = name; wmsLayer.UseCache = false; wmsLayer.Id = 1; wmsLayer.Key = "1"; wmsLayer.Version = tkWmsVersion.wv111; WmsLayerLayer layer = new WmsLayerLayer(); layer.WmsLayerObj = wmsLayer; layer.Name = name; layer.Handle = AxMap.AddLayer(wmsLayer, true); layer.LayerType = LayerType.CustomLayerWMS; MapControlTools.Layers.Add(layer); Events.MapControl_LayerChange layerchange = new Events.MapControl_LayerChange() { LayerChangeReason = Events.LayerChangeReason.AddLayer, Layer = layer }; On_LayerChange(layerchange); return(true); }
private async void Initialize() { try { // Create a map with spatial reference appropriate for the service. Map myMap = new Map(SpatialReference.Create(26915)) { MinScale = 7000000.0 }; // Create a new WMS layer displaying the specified layers from the service. // The default styles are chosen by default. _mnWmsLayer = new WmsLayer(_wmsUrl, _wmsLayerNames); // Wait for the layer to load. await _mnWmsLayer.LoadAsync(); // Center the map on the layer's contents. myMap.InitialViewpoint = new Viewpoint(_mnWmsLayer.FullExtent); // Add the layer to the map. myMap.OperationalLayers.Add(_mnWmsLayer); // Add the map to the view. _myMapView.Map = myMap; // Enable the UI. _styleChoiceButton.Enabled = true; } catch (Exception ex) { // Any exceptions in the async void method must be caught, otherwise they will result in a crash. Debug.WriteLine(ex.ToString()); } }
private async void Initialize() { // Create new Map with basemap Map myMap = new Map(BasemapStyle.ArcGISImageryStandard); // Provide used Map to the MapView _myMapView.Map = myMap; // Create a new WMS layer displaying the specified layers from the service _wmsLayer = new WmsLayer(_wmsUrl, _wmsLayerNames); try { // Load the layer await _wmsLayer.LoadAsync(); // Add the layer to the map _myMapView.Map.OperationalLayers.Add(_wmsLayer); // Zoom to the layer's extent _myMapView.SetViewpoint(new Viewpoint(_wmsLayer.FullExtent)); // Subscribe to tap events - starting point for feature identification _myMapView.GeoViewTapped += _myMapView_GeoViewTapped; } catch (Exception e) { new AlertDialog.Builder(this).SetMessage(e.ToString()).SetTitle("Error").Show(); } }
} // end ToggleButton_OnChecked /// <summary> /// Updates the map view model /// </summary> private void UpdateViewModel(ObservableCollection <LayerInfoVM> displayList) { // Remove all existing layers and redraw map if (BasemapView.Map.OperationalLayers.Count > 1) { BasemapView.Map.OperationalLayers.Clear(); BasemapView.Map.OperationalLayers.Add(baseImageLayer); } // Get a list of selected LayerInfos. selectedLayers = new List <WmsLayerInfo>(displayList.Where(vm => vm.IsEnabled).Select(vm => vm.Info).ToList()); // Return if no layers are selected. if (!selectedLayers.Any()) { haveLayer = false; return; } else { haveLayer = true; } // Create a new WmsLayer from the selected layers. WmsLayer showLayers = new WmsLayer(selectedLayers); // Add the layer(s) to the map. BasemapView.Map.OperationalLayers.Add(showLayers); } // end UpdateViewModel
public WmsSource(string name) { _layer = new WmsLayer() { Name = name }; }
private async void Initialize() { // Show an imagery basemap. _myMapView.Map = new Map(Basemap.CreateImagery()); // Create a new WMS layer displaying the specified layers from the service. _wmsLayer = new WmsLayer(_wmsUrl, _wmsLayerNames); try { // Load the layer. await _wmsLayer.LoadAsync(); // Add the layer to the map. _myMapView.Map.OperationalLayers.Add(_wmsLayer); // Zoom to the layer's extent. _myMapView.SetViewpoint(new Viewpoint(_wmsLayer.FullExtent)); // Subscribe to tap events - starting point for feature identification. _myMapView.GeoViewTapped += _myMapView_GeoViewTapped; } catch (Exception e) { new UIAlertView("Error", e.ToString(), (IUIAlertViewDelegate)null, "OK", null).Show(); } }
/// <summary> /// Updates the map with the latest layer selection /// </summary> private async void UpdateMapDisplay(ObservableCollection <LayerDisplayVM> displayList) { // Remove all existing layers MyMapView.Map.OperationalLayers.Clear(); // Get a list of selected LayerInfos IEnumerable <WmsLayerInfo> selectedLayers = displayList.Where(vm => vm.IsEnabled).Select(vm => vm.Info); // Return if no layers selected if (selectedLayers.Count() < 1) { return; } // Create a new WmsLayer from the selected layers WmsLayer myLayer = new WmsLayer(selectedLayers); // Load the layer await myLayer.LoadAsync(); // Add the layer to the map MyMapView.Map.OperationalLayers.Add(myLayer); // Update the viewpoint await MyMapView.SetViewpointAsync(new Viewpoint(myLayer.FullExtent)); }
private async void Initialize() { try { // Apply an imagery basemap to the map. Map myMap = new Map(Basemap.CreateImagery()); // Create a new WMS layer displaying the specified layers from the service. // The default styles are chosen by default, which corresponds to 'Style 1' in the UI. _mnWmsLayer = new WmsLayer(_wmsUrl, _wmsLayerNames); // Wait for the layer to load. await _mnWmsLayer.LoadAsync(); // Center the map on the layer's contents. myMap.InitialViewpoint = new Viewpoint(_mnWmsLayer.FullExtent); // Add the layer to the map. myMap.OperationalLayers.Add(_mnWmsLayer); // Add the map to the view. _myMapView.Map = myMap; // Enable the UI. _styleChoiceButton.Enabled = true; } catch (Exception ex) { // Any exceptions in the async void method must be caught, otherwise they will result in a crash. Debug.WriteLine(ex.ToString()); } }
/// <summary> /// Updates the map with the latest layer selection. /// </summary> private async void UpdateMapDisplay(ObservableCollection <LayerDisplayVM> displayList) { // Remove all existing layers. MyMapView.Map.OperationalLayers.Clear(); // Get a list of selected LayerInfos. List <WmsLayerInfo> selectedLayers = displayList.Where(vm => vm.IsEnabled).Select(vm => vm.Info).ToList(); // Return if no layers selected. if (!selectedLayers.Any()) { return; } // Create a new WmsLayer from the selected layers. WmsLayer myLayer = new WmsLayer(selectedLayers); try { // Load the layer. await myLayer.LoadAsync(); // Add the layer to the map. MyMapView.Map.OperationalLayers.Add(myLayer); // Update the viewpoint. await MyMapView.SetViewpointAsync(new Viewpoint(myLayer.FullExtent)); } catch (Exception e) { await Application.Current.MainPage.DisplayAlert("Error", e.ToString(), "OK"); } }
/// <summary> /// Updates the map with the latest layer selection /// </summary> private async void UpdateMapDisplay(List<LayerDisplayVM> displayList) { // Remove all existing layers _myMapView.Map.OperationalLayers.Clear(); // Get a list of selected LayerInfos List<WmsLayerInfo> selectedLayers = displayList.Where(vm => vm.IsEnabled).Select(vm => vm.Info).ToList(); // Return if list is empty if (!selectedLayers.Any()) { return; } // Create a new WmsLayer from the selected layers WmsLayer myLayer = new WmsLayer(selectedLayers); try { // Load the layer await myLayer.LoadAsync(); // Zoom to the extent of the layer _myMapView.SetViewpoint(new Viewpoint(myLayer.FullExtent)); // Add the layer to the map _myMapView.Map.OperationalLayers.Add(myLayer); } catch (Exception e) { new AlertDialog.Builder(this).SetMessage(e.ToString()).SetTitle("Error").Show(); } }
private async void InitializeAsync() { try { // Create a map with spatial reference appropriate for the service. Map myMap = new Map(SpatialReference.Create(26915)) { MinScale = 7000000.0 }; // Create a new WMS layer displaying the specified layers from the service. // The default styles are chosen by default. _mnWmsLayer = new WmsLayer(_wmsUrl, _wmsLayerNames); // Wait for the layer to load. await _mnWmsLayer.LoadAsync(); // Center the map on the layer's contents. myMap.InitialViewpoint = new Viewpoint(_mnWmsLayer.FullExtent); // Add the layer to the map. myMap.OperationalLayers.Add(_mnWmsLayer); // Add the map to the view. _myMapView.Map = myMap; // Enable the buttons. _firstStyleButton.Enabled = true; _secondStyleButton.Enabled = true; } catch (Exception ex) { new AlertDialog.Builder(this).SetMessage(ex.ToString()).SetTitle("Error").Show(); } }
private async void Initialize() { // Create new Map with basemap Map myMap = new Map(Basemap.CreateImagery()); // Provide used Map to the MapView MyMapView.Map = myMap; // Create a new WMS layer displaying the specified layers from the service _wmsLayer = new WmsLayer(_wmsUrl, _wmsLayerNames); try { // Load the layer await _wmsLayer.LoadAsync(); // Add the layer to the map MyMapView.Map.OperationalLayers.Add(_wmsLayer); // Zoom to the layer's extent MyMapView.SetViewpoint(new Viewpoint(_wmsLayer.FullExtent)); // Subscribe to tap events - starting point for feature identification MyMapView.GeoViewTapped += MyMapView_GeoViewTapped; } catch (Exception e) { await((Page)Parent).DisplayAlert("Error", e.ToString(), "OK"); } }
/// <summary> /// Updates the map with the latest layer selection. /// </summary> private async void UpdateMapDisplay(List <LayerDisplayVM> displayList) { // Remove all existing layers. _myMapView.Map.OperationalLayers.Clear(); // Get a list of selected LayerInfos. IEnumerable <WmsLayerInfo> selectedLayers = displayList.Where(vm => vm.IsEnabled).Select(vm => vm.Info); // Create a new WmsLayer from the selected layers. WmsLayer myLayer = new WmsLayer(selectedLayers); try { // Wait for the layer to load. await myLayer.LoadAsync(); // Zoom to the extent of the layer. await _myMapView.SetViewpointAsync(new Viewpoint(myLayer.FullExtent)); // Add the layer to the map. _myMapView.Map.OperationalLayers.Add(myLayer); } catch (Exception e) { new UIAlertView("Error", e.ToString(), (IUIAlertViewDelegate)null, "OK", null).Show(); } }
} // end ToggleButton_OnChecked /// <summary> /// Updates the map view model /// </summary> private void UpdateViewModel(ObservableCollection <LayerInfoVM> productList) { // Remove all existing layers and redraw map if (BasemapView.Map.OperationalLayers.Count > 1) { BasemapView.Map.OperationalLayers.Clear(); BasemapView.Map.OperationalLayers.Add(baseImageLayer); } // Get a list of selected LayerInfos selectedLayers = new List <WmsLayerInfo>(productList.Where(checkBox => checkBox.Selected).Select(checkBox => checkBox.Info).ToList()); // Return if no layers are selected. if (!selectedLayers.Any()) { haveLayer = false; return; } else { haveLayer = true; } WmsLayer showLayers = new WmsLayer(selectedLayers); // Add the layer(s) to the map. BasemapView.Map.OperationalLayers.Add(showLayers); } // end UpdateViewModel
private async void Initialize() { try { // Create a map with spatial reference appropriate for the service. Map myMap = new Map(SpatialReference.Create(26915)) { MinScale = 7000000.0 }; // Create a new WMS layer displaying the specified layers from the service. // The default styles are chosen by default. _mnWmsLayer = new WmsLayer(_wmsUrl, _wmsLayerNames); // Wait for the layer to load. await _mnWmsLayer.LoadAsync(); // Center the map on the layer's contents. myMap.InitialViewpoint = new Viewpoint(_mnWmsLayer.FullExtent); // Add the layer to the map. myMap.OperationalLayers.Add(_mnWmsLayer); // Add the map to the view. _myMapView.Map = myMap; // Enable the UI. _styleChoiceButton.Enabled = true; } catch (Exception ex) { new UIAlertView("Error", ex.ToString(), (IUIAlertViewDelegate)null, "OK", null).Show(); } }
public void showChlorophyllWMS(object sender, EventArgs e) { // Create new map Map myMap = new Map(); //Map myMap = new Map(Basemap.CreateDarkGrayCanvasVector()); // Get MapView from the view and assign map from view-model mapView = FindViewById <MapView>(Resource.Id.MyMapView); //get rid of any existing map layers myMap.OperationalLayers.Clear(); mapView.Map = myMap; // Create Chlorophyll WMS layer WmsLayer chlorophyll = new WmsLayer(new Uri("https://coastwatch.pfeg.noaa.gov/erddap/wms/nesdisVHNSQchlaDaily/request?service=WMS&request=GetCapabilities&version=1.3.0"), wmsLayerNames); //WmsLayer chlorophyllTwo = new WmsLayer(new Uri("http://coastwatch.pfeg.noaa.gov/erddap/wms/erdMOchlahday_LonPM180/request?service=WMS&version=1.3.0&request=GetCapabilities"), reefLayerNames); //WmsLayer chlorophyllThree = new WmsLayer(new Uri("https://gibs.earthdata.nasa.gov/wms/epsg4326/best/wms.cgi?request=GetCapabilities&service=WMS"), wmsLayerNames); //ArcGISMapImageLayer chlorophyllLayer = new ArcGISMapImageLayer(new Uri("")) //myMap.OperationalLayers.Add(chlorophyll); // Create a new basemap layer myMap.Basemap.BaseLayers.Add(chlorophyll); }
public static Map InitializeMap(float angle) { string wmsUrl = "http://dev:8080/geoserver/ows?service=wms&version=1.1.1&request=GetCapabilities"; Map map = new Map(); WmsLayer layWms = new WmsLayer("Demis Map", wmsUrl); layWms.AddLayer("sf:roads"); //layWms.AddLayer("Topography"); //layWms.AddLayer("Hillshading"); layWms.SetImageFormat(layWms.OutputFormats[0]); layWms.ContinueOnError = true; //Skip rendering the WMS Map if the server couldn't be requested (if set to false such an event would crash the app) layWms.TimeOut = 5000; //Set timeout to 5 seconds layWms.SRID = 4326; map.Layers.Add(layWms); //limit the zoom to 360 degrees width map.MaximumZoom = 360; map.BackColor = Color.LightBlue; map.Zoom = 360; map.Center = new Point(0, 0); Matrix mat = new Matrix(); mat.RotateAt(angle, map.WorldToImage(map.Center)); map.MapTransform = mat; map.ZoomToExtents(); return(map); }
private void EnableBusStops() { if (wpfMap.Layers.Contains(wpfMap.Layers[secondWmsLayerName])) { return; } const string urlTemplate = "http://ows.terrestris.de/osm-haltestellen?LAYERS=OSM-Bushaltestellen&TRANSPARENT=true&FORMAT=image/png&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG:3857"; // For demonstration of proxy settings some lines of code later // const string urlTemplate = "http://80.146.239.180/WMS/WMS?REQUEST=GetMap&format=image/png&version=1.1.1&layers=xmap-plain&srs=EPSG:505456&styles="; var wmsLayer = new WmsLayer(urlTemplate, false, false, secondWmsLayerName, "© terrestris") { Caption = "Bus stops", Icon = ResourceHelper.LoadBitmapFromResource("Ptv.XServer.Controls.Map;component/Resources/Background.png"), }; wpfMap.Layers.Add(wmsLayer); // code sample demonstrating the settings for configuring a proxy for the web requests // const string domain = "ska-lx-test02"; // const string port = "3128"; // wmsLayer.ReprojectionProvider.Proxy = new WebProxy(string.Format("http://{0}:{1}", domain, port)) { Credentials = new NetworkCredential("marvin", "marvin", domain) }; }
/// <summary> /// Updates the map with the latest layer selection /// </summary> private async void UpdateMapDisplay(List <LayerDisplayVM> displayList) { // Remove all existing layers _myMapView.Map.OperationalLayers.Clear(); // Get a list of selected LayerInfos List <WmsLayerInfo> selectedLayers = displayList.Where(vm => vm.IsEnabled).Select(vm => vm.Info).ToList(); // Return if list is empty if (!selectedLayers.Any()) { return; } // Create a new WmsLayer from the selected layers WmsLayer myLayer = new WmsLayer(selectedLayers); // Load the layer await myLayer.LoadAsync(); // Zoom to the extent of the layer _myMapView.SetViewpoint(new Viewpoint(myLayer.FullExtent)); // Add the layer to the map _myMapView.Map.OperationalLayers.Add(myLayer); }
internal WmsSource(WmsLayer provider) { if (provider == null) { throw new ArgumentNullException("provider"); } _layer = provider; }
private static void AddLayerToLegend(WmsLayer layer, LegendToolItem parent) { var title = layer.RootLayer.Name; var layerItem = parent.AddItem(title); if (layer.Theme != null && layer.Theme.ThemeItems != null) { AddThemeItemsAsLegendItems(layer.Theme.ThemeItems, layerItem, false); } }
private static bool ContinueOnError(ILayer layer) { WmsLayer wmsLayer = layer as WmsLayer; if (wmsLayer != null) { return(wmsLayer.ContinueOnError); } return(true); }
private void Wind_Clicked(object sender, EventArgs e) { // Set Button Colors WaveButton.BackgroundColor = Color.White; WaveButton.BorderColor = Color.FromHex("#5d7772"); WaveButton.TextColor = Color.FromHex("#5d7772"); ReefButton.BackgroundColor = Color.White; ReefButton.BorderColor = Color.FromHex("#5d7772"); ReefButton.TextColor = Color.FromHex("#5d7772"); WindButton.BackgroundColor = Color.FromHex("#5d7772"); WindButton.BorderColor = Color.FromHex("#5d7772"); WindButton.TextColor = Color.White; WaterButton.BackgroundColor = Color.White; WaterButton.BorderColor = Color.FromHex("#5d7772"); WaterButton.TextColor = Color.FromHex("#5d7772"); ChlorophyllButton.BackgroundColor = Color.White; ChlorophyllButton.BorderColor = Color.FromHex("#5d7772"); ChlorophyllButton.TextColor = Color.FromHex("#5d7772"); //get rid of any existing map layers myMap.OperationalLayers.Clear(); // Get MapView from the view and assign map from view-model _mapView = MyMapView; _mapView.Map = myMap; // Create Wind WMS layer WmsLayer wind = new WmsLayer(new Uri("https://gis.ngdc.noaa.gov/arcgis/services/GulfDataAtlas/NCDC_SeaWinds/MapServer/WMSServer?request=GetCapabilities&service=WMS"), wmsLayerNames); myMap.OperationalLayers.Add(wind); //Set Legend LegendLabel.Text = " Wind Speeds"; LegendMetricLabel.Text = " meters per second"; Box1.Color = Color.Blue; Box2.Color = Color.Aqua; Box3.Color = Color.SeaGreen; Box4.Color = Color.YellowGreen; Box5.Color = Color.LightGoldenrodYellow; MetricLabel1.Text = "4"; MetricLabel2.Text = "5"; MetricLabel3.Text = "6"; MetricLabel4.Text = "7"; MetricLabel5.Text = "8"; // Get MapView from the view and assign map from view-model _mapView = MyMapView; _mapView.Map = myMap; }
private void OnFocusedNodeChanged(object sender, FocusedNodeChangedEventArgs e) { WmsLayer layer = tlLayers.GetDataRecordByNode(e.Node) as WmsLayer; if (layer == null) { return; } Provider.ActiveLayerName = layer.Name; mapControl.ZoomToRegion(layer.LeftTop, layer.RightBottom, 0.15); }
public static void SaveMapToStream(Map m, Stream s) { MapDefinition md = new MapDefinition(); md.Extent = new Extent() { Xmin = m.Envelope.MinX, Xmax = m.Envelope.MaxX, Ymin = m.Envelope.MinY, Ymax = m.Envelope.MaxY }; md.BackGroundColor = ColorTranslator.ToHtml(m.BackColor); md.SRID = m.SRID; List <MapLayer> layers = new List <MapLayer>(); foreach (var layer in m.Layers) { MapLayer ml = null; if (layer is SharpMap.Layers.VectorLayer) { } else if (layer is SharpMap.Layers.WmsLayer) { WmsLayer sl = new WmsLayer(); sl.OnlineURL = (layer as SharpMap.Layers.WmsLayer).CapabilitiesUrl; sl.WmsLayers = string.Join(",", (layer as SharpMap.Layers.WmsLayer).LayerList.ToArray()); if ((layer as SharpMap.Layers.WmsLayer).Credentials is NetworkCredential) { sl.WmsUser = ((layer as SharpMap.Layers.WmsLayer).Credentials as NetworkCredential).UserName; sl.WmsPassword = ((layer as SharpMap.Layers.WmsLayer).Credentials as NetworkCredential).Password; } ml = sl; } ml.MinVisible = layer.MinVisible; ml.MaxVisible = layer.MaxVisible; ml.Name = layer.LayerName; if (ml != null) { layers.Add(ml); } } md.Layers = layers.ToArray(); XmlSerializer serializer = new XmlSerializer(typeof(MapDefinition)); serializer.Serialize(s, md); }
public static Map InitializeWmsMap(Size size) { HttpContext.Current.Trace.Write("Initializing Wms map..."); //Initialize a new map of size 'imagesize' Map map = new Map(size); WmsLayer layWms = GetWmsLayer(); //Set up the countries layer VectorLayer layCountries = new VectorLayer("Countries"); //Set the datasource to a shapefile in the App_data folder layCountries.DataSource = new ShapeFile(HttpContext.Current.Server.MapPath(@"~\App_data\countries.shp"), true); //Set fill-style to green layCountries.Style.Fill = new SolidBrush(Color.Green); //Set the polygons to have a black outline layCountries.Style.Outline = Pens.Yellow; layCountries.Style.EnableOutline = true; layCountries.SRID = 4326; //Set up a country label layer LabelLayer layLabel = new LabelLayer("Country labels"); layLabel.DataSource = layCountries.DataSource; layLabel.Enabled = true; layLabel.LabelColumn = "Name"; layLabel.Style = new LabelStyle(); layLabel.Style.ForeColor = Color.White; layLabel.Style.Font = new Font(FontFamily.GenericSerif, 8); layLabel.Style.BackColor = new SolidBrush(Color.FromArgb(128, 255, 0, 0)); layLabel.MaxVisible = 90; layLabel.MinVisible = 30; layLabel.Style.HorizontalAlignment = LabelStyle.HorizontalAlignmentEnum.Center; layLabel.SRID = 4326; //Add the layers to the map object. //The order we add them in are the order they are drawn, so we add the rivers last to put them on top map.Layers.Add(layWms); map.Layers.Add(layCountries); map.Layers.Add(layLabel); //limit the zoom to 360 degrees width map.MaximumZoom = 360; map.BackColor = Color.LightBlue; map.Zoom = 360; map.Center = new Point(0, 0); HttpContext.Current.Trace.Write("Map initialized"); return(map); }
private void OnGetCellValue(object sender, VirtualTreeGetCellValueInfo e) { WmsLayer layer = e.Node as WmsLayer; if (layer == null) { return; } if (e.Column.FieldName == "LayerName") { e.CellData = layer.Title; } }
private void Water_Clicked(object sender, EventArgs e) { // Set Button Colors WaveButton.BackgroundColor = Color.White; WaveButton.BorderColor = Color.FromHex("#5d7772"); WaveButton.TextColor = Color.FromHex("#5d7772"); ReefButton.BackgroundColor = Color.White; ReefButton.BorderColor = Color.FromHex("#5d7772"); ReefButton.TextColor = Color.FromHex("#5d7772"); WindButton.BackgroundColor = Color.White; WindButton.BorderColor = Color.FromHex("#5d7772"); WindButton.TextColor = Color.FromHex("#5d7772"); WaterButton.BackgroundColor = Color.FromHex("#5d7772"); WaterButton.BorderColor = Color.FromHex("#5d7772"); WaterButton.TextColor = Color.White; ChlorophyllButton.BackgroundColor = Color.White; ChlorophyllButton.BorderColor = Color.FromHex("#5d7772"); ChlorophyllButton.TextColor = Color.FromHex("#5d7772"); //get rid of any existing map layers myMap.OperationalLayers.Clear(); // Get MapView from the view and assign map from view-model _mapView = MyMapView; _mapView.Map = myMap; // Create Water Temperature WMS layer WmsLayer waterTemp = new WmsLayer(new Uri("https://gis.ngdc.noaa.gov/arcgis/services/GulfDataAtlas/NODC_SST/MapServer/WMSServer?request=GetCapabilities&service=WMS"), wmsLayerNames); myMap.OperationalLayers.Add(waterTemp); //Set Legend LegendLabel.Text = " Sea Surface Temperature"; LegendMetricLabel.Text = " degrees Fahrenheit"; Box1.Color = Color.LightBlue; Box2.Color = Color.Yellow; Box3.Color = Color.Orange; Box4.Color = Color.OrangeRed; Box5.Color = Color.Red; MetricLabel1.Text = "68"; MetricLabel2.Text = "75"; MetricLabel3.Text = "78"; MetricLabel4.Text = "82"; MetricLabel5.Text = "86"; }
private void add_Click(object sender, EventArgs e) { if (LayersTree.SelectedNode == null) { return; } var tileGroup = LayersTree.SelectedNode.Tag as WMS_Tile_ServiceTiledPatternsTiledGroup; if (tileGroup != null) { AddTiledLayer(tileGroup); return; } var wmsLayer = LayersTree.SelectedNode.Tag as WMS.Layer; var style = LayersTree.SelectedNode.Tag as Style; if (style != null && LayersTree.SelectedNode.Parent != null) { wmsLayer = LayersTree.SelectedNode.Parent.Tag as WMS.Layer; } if (wmsLayer != null) { if (TiledWMS.Checked) { AddTiledLayer(wmsLayer, style); return; } double west = -180; double east = 180; double north = 90; double south = -90; var width = 2048; var height = 2048; if (wmsLayer.EX_GeographicBoundingBox != null) { west = wmsLayer.EX_GeographicBoundingBox.westBoundLongitude; north = wmsLayer.EX_GeographicBoundingBox.northBoundLatitude; east = wmsLayer.EX_GeographicBoundingBox.eastBoundLongitude; south = wmsLayer.EX_GeographicBoundingBox.southBoundLatitude; } if (wmsLayer.LatLonBoundingBox != null) { west = wmsLayer.LatLonBoundingBox.minx; north = wmsLayer.LatLonBoundingBox.maxy; east = wmsLayer.LatLonBoundingBox.maxx; south = wmsLayer.LatLonBoundingBox.miny; } if (wmsLayer.fixedHeight != null ) { var h = int.Parse(wmsLayer.fixedHeight); if (h > 0) { height = h; } } if (wmsLayer.fixedWidth != null) { var w = int.Parse(wmsLayer.fixedWidth); if (w > 0) { width = w; } } var layer = new WmsLayer(); //string path = MakeWmsGetMapUrl(wmsLayer.Name, style != null ? style.Name : "", // west,north, east, south, // width, height, // "", // ""); layer.ServiceUrl = serviceUrl; layer.WmsVersion = wmsVersion; layer.Layers = wmsLayer.Name; layer.Styles = style != null ? style.Name : ""; layer.Overlay.north = north; layer.Overlay.south = south; layer.Overlay.west = west; layer.Overlay.east = east; layer.Height = height; layer.Width = width; if (wmsLayer.Dimension != null) { foreach (var dim in wmsLayer.Dimension) { if (dim.name == "time") { var dates = wmsLayer.Dimension[0].Value.Split(new[] { ',' }); foreach (var date in dates) { layer.TimeRanges.Add(new TimeRange(date)); } layer.UpdateTimeRange(); } } } layer.Enabled = true; layer.Name = wmsLayer.Title; layer.ReferenceFrame = LayerManager.CurrentMap; LayerManager.Add(layer, true); } }