|
POST
|
So would it be something like the following....(apologies I am learning JS as I go along) Layer.fromPortalItem({ portalItem: { id: "e5683bb09bad438aae49eef2a8796296", visibilityMode: "independent", // portal ID number }, layerId: 2, visible: false }).then(function (groupLayer) { // adding all layers into a group layer var map = new Map({ basemap: "dark-gray-vector", layers: groupLayer //adding group layer to the map });
... View more
06-18-2019
12:16 PM
|
0
|
4
|
2766
|
|
POST
|
would I use the visibilityMode to manage only having one layer visibile at a time?
... View more
06-18-2019
11:36 AM
|
0
|
6
|
2766
|
|
POST
|
Hi David, Thank you for your reply! I have tried that and it only accesses one layer at a time. I would like it so that each layer is showing in the Layer list and the widget works with each layer as I turn them on/off respectively. Apologies if I did not explain that in the initial post.
... View more
06-18-2019
10:19 AM
|
0
|
1
|
2766
|
|
POST
|
I am using JavaScript 4.11 and I am trying to get the Feature Widget to access the popupTemplate for each layer that is under the same portalItem ID. So far the widget can only access one of the layers. Is there a way to write the code to have the widget access all of the items? I have the code below. <html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no"> <title>ArcGIS API for JavaScript Adoption Statistics Prototype</title> <style> html, body, #viewDiv { padding: 0; margin: 0; height: 100%; width: 100%; } /*******STYLE FOR THE HOVER FEATURE */ .esri-feature { letter-spacing: 0em; font-family: "Oswald", sans-serif; line-height: 1.55rem; font-feature-settings: "liga" 1, "calt" 0; background: fff; padding: 1em; } </style> <!------------REFERECING ESRI CDN FOR JAVASCRIPT 4.11-------------> <link rel="stylesheet" href="https://js.arcgis.com/4.11/esri/css/main.css"> <script src="https://js.arcgis.com/4.11/"></script> <script> require([ "esri/Map", "esri/views/MapView", "esri/layers/FeatureLayer", //Adding feature layer to the application using FeatureLayer module "esri/widgets/Legend", //Adding Legend to the application "esri/widgets/LayerList", "esri/widgets/Feature" ], function(Map, MapView, FeatureLayer, Legend, LayerList, Feature) { //functions must match the require statements /***************SETTING THE BASEMAP*********** */ var map = new Map({ basemap: "dark-gray-vector", //specify the type of basemap (gray, topo, streets, dark-gray, etc) }); /*************** CONTAINER FOR THE ACTUAL MAP WITH DIMENSIONS*********** */ var view = new MapView({ container: "viewDiv", map: map, center: [-25.432,34.09042], //longitude, latitude--- this is the center location of the map zoom: 2 //zoom level, lower number = more zoomed out }); /*************** ADDING LAYERS TO THE MAP*********** */ var adoptionstats = new FeatureLayer({ portalItem: { id: "e5683bb09bad438aae49eef2a8796296" } }); map.add(adoptionstats, 0); // the zero is for adding order, since only one layer technically do not need this /***************ADD FEATURE POP UP HERE*************************/ view.when().then(function() { var legend = new Legend({ view: view }); view.ui.add(legend, "bottom-left"); var layerList = new LayerList({ view: view }); // Add widget to the top right corner of the view view.ui.add(layerList, "top-right"); // Create a default graphic for when the application starts var graphic = { popupTemplate: { content: "Mouse over features to show details..." } }; // Provide graphic to a new instance of a Feature widget var feature = new Feature({ graphic: graphic, view: view }); view.ui.add(feature, "bottom-right"); view.whenLayerView(adoptionstats).then(function(layerView) { let highlight; // listen for the pointer-move event on the View view.on("pointer-move", function(event) { // Perform a hitTest on the View view.hitTest(event).then(function(event) { // Make sure graphic has a popupTemplate let results = event.results.filter(function(result) { return result.graphic.layer.popupTemplate; }); let result = results[0]; highlight && highlight.remove(); // Update the graphic of the Feature widget // on pointer-move with the result if (result) { feature.graphic = result.graphic; highlight = layerView.highlight(result.graphic); } else { feature.graphic = graphic; } }); }); }); }); /****************END FEATURE POP UP HERE */ }); </script> </head> <body> <div id="viewDiv"></div> </body> </html>
... View more
06-18-2019
06:46 AM
|
0
|
12
|
3516
|
|
POST
|
Last question, the last sentence on the screenshot that you shared. How can I find what privileges are needed to publish server-based layers?
... View more
06-14-2019
10:09 AM
|
0
|
1
|
3166
|
|
POST
|
I am connected to ArcGIS Online. I have a feature service with multiple layers that I wanted to have in my web application and am looking to an effect of this example. Are there any alternatives?
... View more
06-14-2019
04:39 AM
|
0
|
3
|
3166
|
|
POST
|
I am attempting to publish a map image layer from Pro but the options under "Layer Type" only shows Feature, Tile and Vector Tile. Is there a way to get this option? I have attached a screenshot of my Share as a Web Layer pane.
... View more
06-13-2019
01:00 PM
|
0
|
7
|
3435
|
|
POST
|
Hello, I have a dataset that contains information for countries spanning over a number of years. I currently have each year listed as a different layer in my web app (Country A with 2019 data, Country A with 2018 data, etc). Is it possible that when I toggle layers on/off using the layerlist widget, that other widgets will update accordingly? For example, a pie chart (infographic) will update the results based on the visible layers chosen by the user.
... View more
05-31-2019
04:39 AM
|
0
|
0
|
614
|
|
POST
|
Hello, I have a dataset that contains information for countries spanning over a number of years. I currently have each year listed as a different layer in my web app (Country A with 2019 data, Country A with 2018 data, etc). Is it possible that when I toggle layers on/off using the layerlist widget, that other widgets will update accordingly? For example, a pie chart (infographic) will update the results based on the visible layers chosen by the user.
... View more
05-28-2019
07:01 AM
|
0
|
0
|
824
|
|
DOC
|
My customer would only like to see some of the information when hovering over a feature (2 or 3 fields). However, I need the rest of the data for other widgets.
... View more
05-22-2019
06:24 AM
|
0
|
0
|
15632
|
|
DOC
|
Robert, Thanks again for this awesome widget! Is there a way to have the widget only show some of the fields instead of all of them?
... View more
05-22-2019
06:17 AM
|
0
|
0
|
15632
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 11-14-2019 08:23 AM | |
| 1 | 11-14-2019 10:11 AM | |
| 2 | 06-09-2020 06:22 AM | |
| 1 | 12-04-2019 11:53 AM | |
| 7 | 04-29-2019 07:26 AM |
| Online Status |
Offline
|
| Date Last Visited |
02-01-2022
09:16 AM
|