예제 #1
0
        private async void Initialize()
        {
            // Create new map with the dark gray canvas basemap
            Map myMap = new Map(Basemap.CreateDarkGrayCanvasVector());

            // Create a Uri to the image service raster
            var myUri = new Uri("http://sampleserver6.arcgisonline.com/arcgis/rest/services/NLCDLandCover2001/ImageServer");

            // Create new image service raster from the Uri
            ImageServiceRaster myImageServiceRaster = new ImageServiceRaster(myUri);

            // Load the image service raster
            await myImageServiceRaster.LoadAsync();

            // Get the service information (aka. metadata) about the image service raster
            ArcGISImageServiceInfo myArcGISImageServiceInfo = myImageServiceRaster.ServiceInfo;

            // Create a new raster layer from the image service raster
            RasterLayer myRasterLayer = new RasterLayer(myImageServiceRaster);

            // Add the raster layer to the maps layer collection
            myMap.Basemap.BaseLayers.Add(myRasterLayer);

            // Assign the map to the map view
            MyMapView.Map = myMap;

            // Zoom the map to the extent of the image service raster (which also the extent of the raster layer)
            await MyMapView.SetViewpointGeometryAsync(myArcGISImageServiceInfo.FullExtent);

            // NOTE: The sample zooms to the extent of the ImageServiceRaster. Currently the ArcGIS Runtime does not
            // support zooming a RasterLayer out beyond 4 times it's published level of detail. The sample uses
            // MapView.SetViewpointCenterAsync() method to ensure the image shows when the app starts. You can see
            // the effect of the image service not showing when you zoom out to the full extent of the image and beyond.        }
        }
예제 #2
0
        private async void Initialize()
        {
            // Apply an imagery basemap to the map
            MyMapView.Map = new Map(Basemap.CreateDarkGrayCanvasVector());

            // Create the WMS Service
            WmsService service = new WmsService(wmsUrl);

            // Load the WMS Service
            await service.LoadAsync();

            // Get the service info (metadata) from the service
            WmsServiceInfo info = service.ServiceInfo;

            // Get the list of layer infos
            IReadOnlyList <WmsLayerInfo> topLevelLayers = info.LayerInfos;

            // Recursively build up a list of all the layers in the service and get their IDs as a flat list
            List <WmsLayerInfo> expandedList = new List <WmsLayerInfo>();

            BuildLayerInfoList(topLevelLayers, expandedList);

            // Build the ViewModel from the expanded list of layer infos
            foreach (WmsLayerInfo layerInfo in expandedList)
            {
                // LayerDisplayVM is a custom type made for this sample to serve as the ViewModel; it is not a part of the ArcGIS Runtime
                _viewModelList.Add(new LayerDisplayVM(layerInfo));
            }

            // Update the map display based on the viewModel
            UpdateMapDisplay(_viewModelList);

            // Update the list of layers
            MyDisplayList.ItemsSource = _viewModelList;
        }
        private async void Initialize()
        {
            // Create new map with the dark gray canvas basemap.
            Map myMap = new Map(Basemap.CreateDarkGrayCanvasVector());

            // Create a Uri to the image service raster. (NOTE: iOS applications require the use of Uri's to be https:// and not http://)
            Uri myUri = new Uri("https://gis.ngdc.noaa.gov/arcgis/rest/services/bag_hillshades/ImageServer");

            // Create new image service raster from the Uri.
            ImageServiceRaster myImageServiceRaster = new ImageServiceRaster(myUri);

            // Load the image service raster.
            await myImageServiceRaster.LoadAsync();

            // Create a new raster layer from the image service raster.
            RasterLayer myRasterLayer = new RasterLayer(myImageServiceRaster);

            // Add the raster layer to the maps layer collection.
            myMap.Basemap.BaseLayers.Add(myRasterLayer);

            // Assign the map to the map view.
            MyMapView.Map = myMap;

            // zoom in to the San Francisco Bay.
            await MyMapView.SetViewpointCenterAsync(new MapPoint(-13643095.660131, 4550009.846004, SpatialReferences.WebMercator), 100000);
        }
예제 #4
0
        private async void Initialize()
        {
            // Create new map with the dark gray canvas basemap.
            Map myMap = new Map(Basemap.CreateDarkGrayCanvasVector());

            // Create a URI to the image service raster.
            Uri uri = new Uri("https://sampleserver6.arcgisonline.com/arcgis/rest/services/NLCDLandCover2001/ImageServer");

            // Create new image service raster from the URI.
            ImageServiceRaster imageServiceRaster = new ImageServiceRaster(uri);

            // Load the image service raster.
            await imageServiceRaster.LoadAsync();

            // Get the service information (aka. metadata) about the image service raster.
            ArcGISImageServiceInfo arcGISImageServiceInfo = imageServiceRaster.ServiceInfo;

            // Create a new raster layer from the image service raster.
            RasterLayer rasterLayer = new RasterLayer(imageServiceRaster);

            // Add the raster layer to the maps layer collection.
            myMap.Basemap.BaseLayers.Add(rasterLayer);

            // Assign the map to the map view.
            _myMapView.Map = myMap;

            // Zoom the map to the extent of the image service raster (which also the extent of the raster layer).
            await _myMapView.SetViewpointGeometryAsync(arcGISImageServiceInfo.FullExtent);
        }
예제 #5
0
        private async void Initialize()
        {
            // Create the map with a basemap.
            Map myMap = new Map(Basemap.CreateDarkGrayCanvasVector());

            // Create the feature table from the service URL.
            _featureTable = new ServiceFeatureTable(_medicareHospitalSpendLayer);

            // Create the feature layer from the table.
            FeatureLayer myFeatureLayer = new FeatureLayer(_featureTable);

            // Add the feature layer to the map.
            myMap.OperationalLayers.Add(myFeatureLayer);

            try
            {
                // Wait for the feature layer to load.
                await myFeatureLayer.LoadAsync();

                // Set the map initial extent to the extent of the feature layer.
                myMap.InitialViewpoint = new Viewpoint(myFeatureLayer.FullExtent);

                // Add the map to the MapView.
                _myMapView.Map = myMap;
            }
            catch (Exception e)
            {
                new AlertDialog.Builder(this).SetMessage(e.ToString()).SetTitle("Error").Show();
            }
        }
예제 #6
0
        private async void Initialize()
        {
            // Create the map with a basemap.
            Map myMap = new Map(Basemap.CreateDarkGrayCanvasVector());

            // Create the feature table from the service URL.
            _featureTable = new ServiceFeatureTable(_medicareHospitalSpendLayer);

            // Create the feature layer from the table.
            FeatureLayer myFeatureLayer = new FeatureLayer(_featureTable);

            // Add the feature layer to the map.
            myMap.OperationalLayers.Add(myFeatureLayer);

            try
            {
                // Wait for the feature layer to load.
                await myFeatureLayer.LoadAsync();

                // Set the map initial extent to the extent of the feature layer.
                myMap.InitialViewpoint = new Viewpoint(myFeatureLayer.FullExtent);

                // Add the map to the MapView.
                MyMapView.Map = myMap;
            }
            catch (Exception e)
            {
                await Application.Current.MainPage.DisplayAlert("Error", e.ToString(), "OK");
            }
        }
예제 #7
0
        private async void Initialize()
        {
            // Apply an imagery basemap to the map.
            MyMapView.Map = new Map(Basemap.CreateDarkGrayCanvasVector());

            // Create the WMS Service.
            WmsService service = new WmsService(_wmsUrl);

            try
            {
                // Load the WMS Service.
                await service.LoadAsync();

                // Get the service info (metadata) from the service.
                WmsServiceInfo info = service.ServiceInfo;

                // Get the list of layer infos.
                foreach (var layerInfo in info.LayerInfos)
                {
                    LayerDisplayVM.BuildLayerInfoList(new LayerDisplayVM(layerInfo, null), _viewModelList);
                }

                // Update the map display based on the viewModel.
                UpdateMapDisplay(_viewModelList);

                // Update the list of layers.
                LayerTreeView.ItemsSource = _viewModelList.Take(1);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString(), "Error");
            }
        }
        private async void Initialize()
        {
            // Apply an imagery basemap to the map
            _myMapView.Map = new Map(Basemap.CreateDarkGrayCanvasVector());

            // Create the WMS Service
            WmsService service = new WmsService(_wmsUrl);

            // Load the WMS Service
            await service.LoadAsync();

            // Get the service info (metadata) from the service.
            WmsServiceInfo info = service.ServiceInfo;

            // Get the list of layer infos.
            foreach (var layerInfo in info.LayerInfos)
            {
                LayerDisplayVM.BuildLayerInfoList(new LayerDisplayVM(layerInfo, null), _viewModelList);
            }

            // Create an array adapter for the layer display
            ArrayAdapter adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerItem, _viewModelList);

            // Apply the adapter
            _myDisplayList.Adapter = adapter;

            // Subscribe to selection change notifications
            _myDisplayList.ItemClick += _myDisplayList_ItemClick;

            // Update the map display based on the viewModel
            UpdateMapDisplay(_viewModelList);
        }
        private async void Initialize()
        {
            // Show dark gray canvas basemap.
            _myMapView.Map = new Map(Basemap.CreateDarkGrayCanvasVector());

            // Create the WMS Service.
            WmsService service = new WmsService(_wmsUrl);

            // Load the WMS Service.
            await service.LoadAsync();

            // Get the service info (metadata) from the service.
            WmsServiceInfo info = service.ServiceInfo;

            List <LayerDisplayVM> viewModelList = new List <LayerDisplayVM>();

            // Get the list of layer infos.
            foreach (var layerInfo in info.LayerInfos)
            {
                LayerDisplayVM.BuildLayerInfoList(new LayerDisplayVM(layerInfo, null), viewModelList);
            }

            // Construct the layer list source.
            _layerListSource = new LayerListSource(viewModelList, this);

            // Set the source for the table view (layer list).
            _myDisplayList.Source = _layerListSource;

            // Force an update of the list display.
            _myDisplayList.ReloadData();
        }
        private void Initialize()
        {
            // Add event handler for when this sample is unloaded.
            Unloaded += SampleUnloaded;

            // Create new Map with basemap.
            Map myMap = new Map(Basemap.CreateDarkGrayCanvasVector());

            // Display the map.
            MyMapView.Map = myMap;

            // Create and add graphics overlay for displaying the trail.
            _locationHistoryLineOverlay = new GraphicsOverlay();
            SimpleLineSymbol locationLineSymbol = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, System.Drawing.Color.Lime, 2);

            _locationHistoryLineOverlay.Renderer = new SimpleRenderer(locationLineSymbol);
            MyMapView.GraphicsOverlays.Add(_locationHistoryLineOverlay);

            // Create and add graphics overlay for showing points.
            _locationHistoryOverlay = new GraphicsOverlay();
            SimpleMarkerSymbol locationPointSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Circle, System.Drawing.Color.Red, 3);

            _locationHistoryOverlay.Renderer = new SimpleRenderer(locationPointSymbol);
            MyMapView.GraphicsOverlays.Add(_locationHistoryOverlay);

            // Create the polyline builder.
            _polylineBuilder = new PolylineBuilder(SpatialReferences.WebMercator);

            // Start location services.
            HandleLocationReady();
        }
예제 #11
0
        public MainWindow()
        {
            InitializeComponent();
            var myMap = new Map();

            myMap.Basemap = Basemap.CreateDarkGrayCanvasVector();
            myMapView.Map = myMap;
        }
예제 #12
0
        // 改变底图
        private void ChangeBaseMap_list_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Map myMap = myMapView.Map;

            switch (ChangeBaseMap_list.SelectedIndex)
            {
            case 0:
                myMap.Basemap = Basemap.CreateDarkGrayCanvasVector();
                myMapView_Eagle.Map.Basemap = Basemap.CreateDarkGrayCanvasVector();
                break;

            case 1:
                myMap.Basemap = Basemap.CreateImagery();
                myMapView_Eagle.Map.Basemap = Basemap.CreateImagery();
                break;

            case 2:
                myMap.Basemap = Basemap.CreateImageryWithLabels();
                myMapView_Eagle.Map.Basemap = Basemap.CreateImageryWithLabels();
                break;

            case 3:
                myMap.Basemap = Basemap.CreateTerrainWithLabels();
                myMapView_Eagle.Map.Basemap = Basemap.CreateTerrainWithLabels();
                break;

            case 4:
                myMap.Basemap = Basemap.CreateLightGrayCanvas();
                myMapView_Eagle.Map.Basemap = Basemap.CreateLightGrayCanvas();
                break;

            case 5:
                myMap.Basemap = Basemap.CreateTopographic();
                myMapView_Eagle.Map.Basemap = Basemap.CreateTopographic();
                break;

            case 6:
                myMap.Basemap = Basemap.CreateNationalGeographic();
                myMapView_Eagle.Map.Basemap = Basemap.CreateNationalGeographic();
                break;

            case 7:
                myMap.Basemap = Basemap.CreateNavigationVector();
                myMapView_Eagle.Map.Basemap = Basemap.CreateNavigationVector();
                break;

            case 8:
                myMap.Basemap = Basemap.CreateOceans();
                myMapView_Eagle.Map.Basemap = Basemap.CreateOceans();
                break;

            case 9:
                myMap.Basemap = Basemap.CreateStreets();
                myMapView_Eagle.Map.Basemap = Basemap.CreateStreets();
                break;
            }
        }
예제 #13
0
        // Creates Air Quality Map
        public void Initialize()
        {
            var mapClass          = new MapClasses.AirQualityMap();
            var airQualityContour = mapClass.AirNowLatest;
            var airQualityCities  = mapClass.AirNowTodaysForecast;
            Map airMap            = new Map(Basemap.CreateDarkGrayCanvasVector());

            airMap.OperationalLayers.Add(airQualityContour);
            airMap.OperationalLayers.Add(airQualityCities);
            AirMap.Map = airMap;
            AirMap.Map.InitialViewpoint = new Viewpoint(new Envelope(-134.44, 12.8577894, -57.1276444, 57.91, new SpatialReference(4326)));
        }
예제 #14
0
        private async Task InitMap()
        {
            // Get the artist and listener layers from ArcGIS Online
            ArcGISPortal portal = await ArcGISPortal.CreateAsync();

            PortalItem artistLayerItem = await PortalItem.CreateAsync(portal, _artistsLayerId);

            PortalItem listenerLayerItem = await PortalItem.CreateAsync(portal, _listenersLayerId);

            PortalItem otherLayerItem = await PortalItem.CreateAsync(portal, _otherPlacesLayerId);

            PortalItem tourLayerItem = await PortalItem.CreateAsync(portal, _tourLayerId);

            _artistHometownLayer           = new FeatureLayer(artistLayerItem, 0);
            _listenerLayer                 = new FeatureLayer(listenerLayerItem, 0);
            _otherLocationsLayer           = new FeatureLayer(otherLayerItem, 0);
            _tourLayer                     = new FeatureLayer(tourLayerItem, 0);
            _artistHometownLayer.IsVisible = false;
            _listenerLayer.IsVisible       = false;
            _otherLocationsLayer.IsVisible = false;
            _tourLayer.IsVisible           = false;

            // Create the map to show artist locations
            Map artistMap = new Map(Basemap.CreateLightGrayCanvasVector());

            artistMap.OperationalLayers.Add(_artistHometownLayer);
            artistMap.OperationalLayers.Add(_tourLayer);
            artistMap.OperationalLayers.Add(_otherLocationsLayer);

            // Create the map to show listener cities
            Map listenersMap = new Map(Basemap.CreateDarkGrayCanvasVector());

            listenersMap.OperationalLayers.Add(_listenerLayer);

            // Add the maps to their views
            ArtistMapView.Map    = artistMap;
            ListenersMapView.Map = listenersMap;

            // Authorize with Spotify and get an access token
            //_spotifyAcessToken = GetClientCredentialsAuthToken();
            Task <bool> authTask = ConnectToSpotifyOAuth();
            await       authTask;

            // Get the tracks for the provided playlist
            Paging <PlaylistTrack> tracks = _spotify.GetPlaylistTracks(_spotifyTestPlaylistId);

            // Call a function to get a collection of track and artist info
            _playlistTrackInfo = await GetPlaylistArtists(tracks, _artistHometownLayer.FeatureTable);

            ArtistListBox.ItemsSource   = _playlistTrackInfo;
            ArtistListBox.SelectedIndex = 0;
        }
예제 #15
0
        private void Initialize()
        {
            // Set up the basemap.
            _myMapView.Map = new Map(Basemap.CreateDarkGrayCanvasVector());

            // Create the dataset.
            KmlDataset dataset = new KmlDataset(new Uri("https://www.wpc.ncep.noaa.gov/kml/noaa_chart/WPC_Day1_SigWx.kml"));

            // Create the layer from the dataset.
            _forecastLayer = new KmlLayer(dataset);

            // Add the layer to the map.
            _myMapView.Map.OperationalLayers.Add(_forecastLayer);

            // Zoom to the extent of the United States.
            _myMapView.SetViewpoint(new Viewpoint(_usEnvelope));
        }
예제 #16
0
        public void showWaterTempWMS(object sender, EventArgs e)
        {
            // Create 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 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);
        }
예제 #17
0
        public void showWaveWMS(object sender, EventArgs e)
        {
            // Create 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 Wave WMS layer
            WmsLayer wave = new WmsLayer(new Uri("https://nowcoast.noaa.gov/arcgis/services/nowcoast/forecast_meteoceanhydro_sfc_ndfd_signwaveht_offsets/MapServer/WMSServer?request=GetCapabilities&service=WMS"), wmsLayerNames);

            myMap.OperationalLayers.Add(wave);
        }
예제 #18
0
        public BlankPage1()
        {
            this.InitializeComponent();

            MySceneView.Scene = new Scene(Basemap.CreateDarkGrayCanvasVector());
            MySceneView.Scene.BaseSurface.ElevationSources.Add(new ArcGISTiledElevationSource(new System.Uri("https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer")));

            // Define rendering mode for VR experience.
            MySceneView.StereoRendering          = new SideBySideBarrelDistortionStereoRendering();
            MySceneView.IsAttributionTextVisible = false;

            var camera = new Camera(34.02209, -118.2853, 1000, 0, 45, 0);

            MySceneView.SetViewpointCamera(camera);

            var             wgs84 = MySceneView.Scene.SpatialReference;
            GraphicsOverlay go    = new GraphicsOverlay();

            go.SceneProperties.SurfacePlacement = SurfacePlacement.Relative;
            var rnd = new System.Random();

            for (int i = 0; i < 50; i++)
            {
                var buoy1Loc = new MapPoint(-118.2606, 34.0498, 1000, wgs84);

                // create a marker symbol
                var buoyMarker = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Circle, Colors.Red, 10);

                // create graphics
                var buoyTest = new Graphic(buoy1Loc, buoyMarker);

                go.Graphics.Add(buoyTest);

                /* Make the intercontinental marked */
                Task.Factory.StartNew(async() => {
                    while (true)
                    {
                        buoyTest.Geometry = new MapPoint(-118.2606 + rnd.NextDouble(), 34.0498 + rnd.NextDouble(), rnd.Next(0, 1000));
                        await Task.Delay(100);
                    }
                });
            }
            MySceneView.GraphicsOverlays.Add(go);
        }
예제 #19
0
        public static Basemap FromBasemapType(this BasemapType type)
        {
            switch (type)
            {
            case BasemapType.DarkGrayCanvasVector: return(Basemap.CreateDarkGrayCanvasVector());

            case BasemapType.Imagery: return(Basemap.CreateImagery());

            case BasemapType.ImageryWithLabels: return(Basemap.CreateImageryWithLabels());

            case BasemapType.ImageryWithLabelsVector: return(Basemap.CreateImageryWithLabelsVector());

            case BasemapType.LightGrayCanvas: return(Basemap.CreateLightGrayCanvas());

            case BasemapType.LightGrayCanvasVector: return(Basemap.CreateLightGrayCanvasVector());

            case BasemapType.NationalGeographic: return(Basemap.CreateNationalGeographic());

            case BasemapType.NavigationVector: return(Basemap.CreateNavigationVector());

            case BasemapType.Oceans: return(Basemap.CreateOceans());

            case BasemapType.OpenStreetMap: return(Basemap.CreateOpenStreetMap());

            case BasemapType.Streets: return(Basemap.CreateStreets());

            case BasemapType.StreetsNightVector: return(Basemap.CreateStreetsNightVector());

            case BasemapType.StreetsVector: return(Basemap.CreateStreetsVector());

            case BasemapType.StreetsWithReliefVector: return(Basemap.CreateStreetsWithReliefVector());

            case BasemapType.TerrainWithLabels: return(Basemap.CreateTerrainWithLabels());

            case BasemapType.TerrainWithLabelsVector: return(Basemap.CreateTerrainWithLabelsVector());

            case BasemapType.Topographic: return(Basemap.CreateTopographic());

            case BasemapType.TopographicVector: return(Basemap.CreateTopographicVector());

            default: throw new NotImplementedException(type.ToString());
            }
        }
예제 #20
0
        public void showReefWMS(object sender, EventArgs e)
        {
            // Create 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 Reef WMS layer
            WmsLayer reefWms = new WmsLayer(new Uri("https://gis.ngdc.noaa.gov/arcgis/services/deep_sea_corals/MapServer/WMSServer?request=GetCapabilities&service=WMS"), reefLayerNames);
            WmsLayer reef    = new WmsLayer(new Uri("https://gis.ngdc.noaa.gov/arcgis/services/deep_sea_corals/MapServer/WMSServer?request=GetCapabilities&service=WMS"), wmsLayerNames);

            myMap.OperationalLayers.Add(reefWms);
        }
예제 #21
0
        public MapViewModel()
        {
            // Initialize a new basemap
            _basemap = Basemap.CreateDarkGrayCanvasVector();
            var status = _basemap.LoadStatus;

            switch (status)
            {
            case LoadStatus.Loaded:
                // Create a map
                Map = new Map(_basemap);

                // Create and load the countries layer
                _countries = CreateWorldCountriesTable();
                _countries.LoadAsync();

                // Create the graphics overlays
                _geonamesOverlay  = CreateGeonamesOverlay();
                _countriesOverlay = CreateCountriesOverlay();

                // Create a timer
                _timer          = new DispatcherTimer(DispatcherPriority.ApplicationIdle);
                _timer.Interval = new TimeSpan(0, 0, 0, 0, 500);
                _timer.Tick    += Animate;

                // Add it to the map view
                Overlays = new GraphicsOverlayCollection();
                Overlays.Add(_geonamesOverlay);
                Overlays.Add(_countriesOverlay);
                break;

            default:
                // TODO: Error handling
                break;
            }

            // Update the commands
            var geonamesOverlay = new GeonamesOverlay(_geonamesOverlay, _countries, _countriesOverlay);

            LoadGeonamesFileCommand            = new LoadGeonamesFileCommand(geonamesOverlay);
            CalculateGeonamesStatisticsCommand = new CalculateGeonamesStatisticsCommand(geonamesOverlay);
        }
예제 #22
0
        private async void Initialize()
        {
            // Set up the basemap.
            MyMapView.Map = new Map(Basemap.CreateDarkGrayCanvasVector());

            // Create the dataset.
            KmlDataset dataset = new KmlDataset(new Uri("https://www.wpc.ncep.noaa.gov/kml/noaa_chart/WPC_Day1_SigWx.kml"));

            // Create the layer from the dataset.
            _forecastLayer = new KmlLayer(dataset);

            // Add the layer to the map.
            MyMapView.Map.OperationalLayers.Add(_forecastLayer);

            // Zoom to the extent of the United States.
            await MyMapView.SetViewpointAsync(new Viewpoint(_usEnvelope));

            // Listen for taps to identify features.
            MyMapView.GeoViewTapped += MyMapView_GeoViewTapped;
        }
예제 #23
0
        private async void Initialize()
        {
            // Apply an imagery basemap to the map
            _myMapView.Map = new Map(Basemap.CreateDarkGrayCanvasVector());

            // Create the WMS Service
            WmsService service = new WmsService(wmsUrl);

            // Load the WMS Service
            await service.LoadAsync();

            // Get the service info (metadata) from the service
            WmsServiceInfo info = service.ServiceInfo;

            // Get the list of layer infos
            IReadOnlyList <WmsLayerInfo> topLevelLayers = info.LayerInfos;

            // Recursively build up a list of all the layers in the service and get their IDs as a flat list
            List <WmsLayerInfo> expandedList = new List <WmsLayerInfo>();

            BuildLayerInfoList(topLevelLayers, expandedList);

            // Build the ViewModel from the expanded list of layer infos
            foreach (WmsLayerInfo layerInfo in expandedList)
            {
                // LayerDisplayVM is a custom type made for this sample to serve as the ViewModel; it is not a part of the ArcGIS Runtime
                _viewModelList.Add(new LayerDisplayVM(layerInfo));
            }

            // Create an array adapter for the layer display
            ArrayAdapter adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerItem, _viewModelList);

            // Apply the adapter
            _myDisplayList.Adapter = adapter;

            // Subscribe to selection change notifications
            _myDisplayList.ItemClick += _myDisplayList_ItemClick;;

            // Update the map display based on the viewModel
            UpdateMapDisplay(_viewModelList);
        }
        private async void Initialize()
        {
            // Apply an imagery basemap to the map
            _myMapView.Map = new Map(Basemap.CreateDarkGrayCanvasVector());

            // Create the WMS Service
            WmsService service = new WmsService(wmsUrl);

            // Load the WMS Service
            await service.LoadAsync();

            // Get the service info (metadata) from the service
            WmsServiceInfo info = service.ServiceInfo;

            // Get the list of layer infos
            IReadOnlyList <WmsLayerInfo> topLevelLayers = info.LayerInfos;

            // Recursively build up a list of all the layers in the service and get their IDs as a flat list
            List <WmsLayerInfo> expandedList = new List <WmsLayerInfo>();

            BuildLayerInfoList(topLevelLayers, expandedList);

            List <LayerDisplayVM> displayList = new List <LayerDisplayVM>();

            // Build the ViewModel from the expanded list of layer infos
            foreach (WmsLayerInfo layerInfo in expandedList)
            {
                // LayerDisplayVM is a custom type made for this sample to serve as the ViewModel; it is not a part of the ArcGIS Runtime
                displayList.Add(new LayerDisplayVM(layerInfo));
            }

            // Construct the layer list source
            _layerListSource = new LayerListSource(displayList, this);

            // Set the source for the table view (layer list)
            _myDisplayList.Source = _layerListSource;

            // Force an update of the list display
            _myDisplayList.ReloadData();
        }
        private async void Initialize()
        {
            // Create the map with a basemap.
            Map myMap = new Map(Basemap.CreateDarkGrayCanvasVector());

            // Create the feature table from the service URL.
            _featureTable = new ServiceFeatureTable(_medicareHospitalSpendLayer);

            // Create the feature layer from the table.
            FeatureLayer myFeatureLayer = new FeatureLayer(_featureTable);

            // Add the feature layer to the map.
            myMap.OperationalLayers.Add(myFeatureLayer);

            // Wait for the feature layer to load.
            await myFeatureLayer.LoadAsync();

            // Set the map initial extent to the extent of the feature layer.
            myMap.InitialViewpoint = new Viewpoint(myFeatureLayer.FullExtent);

            // Add the map to the MapView.
            MyMapView.Map = myMap;
        }
예제 #26
0
        private void Initialize()
        {
            // Create new map with the dark gray canvas basemap.
            Map myMap = new Map(Basemap.CreateDarkGrayCanvasVector());

            // Create a Uri to the image service raster.
            Uri uri = new Uri("https://gis.ngdc.noaa.gov/arcgis/rest/services/bag_hillshades/ImageServer");

            // Create new image service raster from the Uri.
            ImageServiceRaster imageServiceRaster = new ImageServiceRaster(uri);

            // Create a new raster layer from the image service raster.
            RasterLayer rasterLayer = new RasterLayer(imageServiceRaster);

            // Add the raster layer to the maps layer collection.
            myMap.Basemap.BaseLayers.Add(rasterLayer);

            // Assign the map to the map view.
            _myMapView.Map = myMap;

            // zoom in to the San Francisco Bay.
            _myMapView.SetViewpointCenterAsync(new MapPoint(-13643095.660131, 4550009.846004, SpatialReferences.WebMercator), 100000);
        }
예제 #27
0
        public Basemap GetBasemap(BasemapType basemapType)
        {
            Basemap basemap = null;

            switch (basemapType)
            {
            case BasemapType.Imagery:
                basemap = Basemap.CreateImagery();
                break;

            case BasemapType.ImageryWithLabels:
                basemap = Basemap.CreateImageryWithLabels();
                break;

            case BasemapType.Streets:
                basemap = Basemap.CreateStreets();
                break;

            case BasemapType.Topographic:
                basemap = Basemap.CreateTopographic();
                break;

            case BasemapType.TerrainWithLabels:
                basemap = Basemap.CreateTerrainWithLabels();
                break;

            case BasemapType.LightGrayCanvas:
                basemap = Basemap.CreateLightGrayCanvas();
                break;

            case BasemapType.NationalGeographic:
                basemap = Basemap.CreateNationalGeographic();
                break;

            case BasemapType.Oceans:
                basemap = Basemap.CreateOceans();
                break;

            case BasemapType.OpenStreetMap:
                basemap = Basemap.CreateOpenStreetMap();
                break;

            case BasemapType.ImageryWithLabelsVector:
                basemap = Basemap.CreateImageryWithLabelsVector();
                break;

            case BasemapType.StreetsVector:
                basemap = Basemap.CreateStreetsVector();
                break;

            case BasemapType.TopographicVector:
                basemap = Basemap.CreateTopographicVector();
                break;

            case BasemapType.TerrainWithLabelsVector:
                basemap = Basemap.CreateTerrainWithLabelsVector();
                break;

            case BasemapType.LightGrayCanvasVector:
                basemap = Basemap.CreateLightGrayCanvasVector();
                break;

            case BasemapType.NavigationVector:
                basemap = Basemap.CreateNavigationVector();
                break;

            case BasemapType.StreetsNightVector:
                basemap = Basemap.CreateStreetsVector();
                break;

            case BasemapType.StreetsWithReliefVector:
                basemap = Basemap.CreateStreetsWithReliefVector();
                break;

            case BasemapType.DarkGrayCanvasVector:
                basemap = Basemap.CreateDarkGrayCanvasVector();
                break;

            default:
                break;
            }

            return(basemap);
        }
예제 #28
0
        public Basemap GetBaseMap(CusMapView cusMapView)
        {
            switch (cusMapView.Map.MapType)
            {
            case MapType.Imagery:
                return(Basemap.CreateImagery());

            case MapType.Streets:
                return(Basemap.CreateStreets());

            case MapType.ImageryWithLabels:
                return(Basemap.CreateImageryWithLabels());

            case MapType.ImageryWithLabelsVector:
                return(Basemap.CreateImageryWithLabelsVector());

            case MapType.LightGrayCanvas:
                return(Basemap.CreateLightGrayCanvas());

            case MapType.LightGrayCanvasVector:
                return(Basemap.CreateLightGrayCanvasVector());

            case MapType.DarkGrayCanvasVector:
                return(Basemap.CreateDarkGrayCanvasVector());

            case MapType.NationalGeographic:
                return(Basemap.CreateNationalGeographic());

            case MapType.Oceans:
                return(Basemap.CreateOceans());

            case MapType.StreetsVector:
                return(Basemap.CreateStreetsVector());

            case MapType.StreetsWithReliefVector:
                return(Basemap.CreateStreetsWithReliefVector());

            case MapType.StreetsNightVector:
                return(Basemap.CreateStreetsNightVector());

            case MapType.NavigationVector:
                return(Basemap.CreateNavigationVector());

            case MapType.TerrainWithLabels:
                return(Basemap.CreateTerrainWithLabels());

            case MapType.TerrainWithLabelsVector:
                return(Basemap.CreateTerrainWithLabelsVector());

            case MapType.Topographic:
                return(Basemap.CreateTopographic());

            case MapType.TopographicVector:
                return(Basemap.CreateTopographicVector());

            case MapType.OpenStreetMap:
                return(Basemap.CreateOpenStreetMap());

            case MapType.WebMap:
                if (!string.IsNullOrEmpty(cusMapView.Map.WebMapUrl))
                {
                    return(new Basemap(new Uri(cusMapView.Map.WebMapUrl)));
                }

                throw new ArgumentOutOfRangeException(nameof(cusMapView.Map.WebMapUrl), cusMapView.Map.WebMapUrl, null);

            default:
                throw new ArgumentOutOfRangeException(nameof(cusMapView.Map.MapType), cusMapView.Map.MapType, null);
            }
        }