|
POST
|
For my customer I am building an application where I query a Featurelayer. function queryFeatureLayer() { var query = { spatialRelationship: "intersects", outFields: ["*"], returnGeometry: true, where: field = value }; featurelayer.queryFeatures(query).then(function(result) { // handle results }); } This works for a simple attribute field (string) . Assume field = "animal", value = "dog" where: "animal" = "dog" This returns all features that have the string "dog" in this field. Now the "animal" field is changed to hold a string-list, a domain. In AGOL this gives a popup list with a few animals Assume: ("dog", "cat", "mouse"). I want to query this field but I get errors using: where: "animal = dog" or where: "animal = 1" The error: Cannot perform query. Invalid query parameters. How can I set up a working query to search for all Features that have "dog" set in field "animal" using a Domain string attribute field? Thanks
... View more
04-28-2020
06:05 AM
|
0
|
6
|
1432
|
|
POST
|
Working on a project for my customer. I use this code to get information about the features on the WebMap when I click on a feature: view.on("click", function(event){ view.hitTest(event.screenPoint) .then(function(response){ graphic = response.results[0].graphic; if (graphic) { console.log(JSON.stringify(response)); // more code here... } }); }); The project has 3 layers and about 8 attributes. So I want to know to which layer the feature belongs when clicked. The first layer gives me in the attributes: "attributes": { "OBJECTID_1": 56495, "gewascateg": "Grasland" }, The second layer gives me in the attributes: "attributes": { "FID": 18 }, The third layer gives me in the attributes: "attributes": { "FID": 45 }, I would like to add another field in the attributes, that has a unique name, for layer 2 and 3 and is present in the Graphic Only the FID is present. Right now, there is nothing to determine which layer belongs to the FID. The first layer shows more attributes can be set. Both layers can have the same FID numbers (only unique within the layer) but can be assigned to different area's / features. The first layer shows, more attributes can be set, but I have no clue where to set which attribute comes with the Graphic. Where can I set which attribute is assigned to the Graphic? This is the total result on a click in JSON string format: { "screenPoint": { "x": 843, "y": 225 }, "results": [{ "mapPoint": { "spatialReference": { "latestWkid": 3857, "wkid": 102100 }, "x": 611540.7659679214, "y": 6729471.200288476 }, "graphic": { "geometry": { "spatialReference": { "latestWkid": 3857, "wkid": 102100 }, "rings": [ [ [611591.7725636219, 6729429.978571325], [611543.9994209437, 6729434.755885593], [611472.3397069264, 6729439.533199861], [611505.7809068011, 6729525.524856682], [611548.7767352115, 6729520.747542414], [611553.5540494793, 6729515.970228146], [611563.108678015, 6729515.970228146], [611567.8859922828, 6729525.524856682], [611567.8859922828, 6729530.30217095], [611572.6633065506, 6729544.634113753], [611625.2137634966, 6729539.856799485], [611629.9910777644, 6729530.302170949], [611610.8818206931, 6729463.419771199], [611591.7725636219, 6729429.978571325] ] ] }, "symbol": null, "attributes": { "FID": 45 }, "popupTemplate": null } }, { "mapPoint": { "spatialReference": { "latestWkid": 3857, "wkid": 102100 }, "x": 611540.7659679214, "y": 6729471.200288476 }, "graphic": { "geometry": { "spatialReference": { "latestWkid": 3857, "wkid": 102100 }, "rings": [ [ [611591.7725636242, 6729429.978571325], [611543.999420946, 6729434.755885593], [611472.3397069287, 6729439.533199861], [611505.7809068034, 6729525.524856682], [611548.7767352138, 6729520.747542414], [611553.5540494816, 6729515.970228146], [611563.1086780173, 6729515.970228146], [611567.8859922851, 6729525.524856682], [611567.8859922851, 6729530.30217095], [611572.6633065529, 6729544.634113753], [611625.2137634989, 6729539.856799485], [611629.9910777668, 6729530.302170949], [611610.8818206955, 6729463.419771199], [611591.7725636242, 6729429.978571325] ] ] }, "symbol": null, "attributes": { "FID": 18 }, "popupTemplate": null } }, { "mapPoint": { "spatialReference": { "latestWkid": 3857, "wkid": 102100 }, "x": 611540.7659679214, "y": 6729471.200288476 }, "graphic": { "geometry": { "spatialReference": { "latestWkid": 3857, "wkid": 102100 }, "rings": [ [ [611591.7725636219, 6729429.978571325], [611543.9994209437, 6729434.755885593], [611472.3397069264, 6729439.533199861], [611505.7809068011, 6729525.524856682], [611548.7767352115, 6729520.747542414], [611553.5540494793, 6729515.970228146], [611563.108678015, 6729515.970228146], [611567.8859922828, 6729525.524856682], [611567.8859922828, 6729530.30217095], [611572.6633065506, 6729544.634113753], [611625.2137634966, 6729539.856799485], [611629.9910777644, 6729530.302170949], [611610.8818206931, 6729463.419771199], [611591.7725636219, 6729429.978571325] ] ] }, "symbol": null, "attributes": { "OBJECTID_1": 56495, "gewascateg": "Grasland" }, "popupTemplate": null } }] }
... View more
04-22-2020
03:38 AM
|
0
|
0
|
399
|
|
POST
|
How can I open a Web Mapping App that is in AGOL, with a token? I succeeded in requesting a token and open a AGOL private WebMap with that token. I can't find any support for opening a Web Mapping App with the Javascript API. I can open the Web Mapping App with a standard Javascript window.open. I do not want users to enter credentials. That has already been done when requesting the token.
... View more
04-01-2020
09:20 AM
|
0
|
0
|
411
|
|
POST
|
OK, John. What I want to do. This is a requirement from a customer. They have a map with area's / polygons, that indicate a specific location where a certain task: - should start ( the area is in a color, Purple, Blue or Olive, each color represents a certain task) - is finished ( the job in this area is done, the color must be Green). A task is a work job, that a worker must do, example: cleaning the area. The customer has, (indeed you are correct, sorry for the misleading information), 3 instances of a Featurelayer on his map: 1. Vloer (Dutch for floor) 2. Vlakken (Dutch for area's) 3. Vlakken - gereed (Ducth for area's completed) It is the same Featurelayer, and the viewable area's on the layers depend on the filter: 1. Vloer, filter setting: only displays the area with id 5, this is the purple area. 2. Vlakken, filter setting: display the area's where id <> 5, the other 3 area's 3. Vlakken - gereed, filter setting: display the area's where id <> 5 AND Attribute: "Dat_uitv" is not empty. This is the setting my customer made, and he wanted met to fill the "Dat_uitv" attribute with the current date time stamp, when they click on the specific area. Doing that, the map displays which area's have the job finished by showing the area "Vlakken - gereed" layer, according to the filter. Once the "Dat_uitv" attribute has a valid value, the filter of layer "Vlakken - gereed" is TRUE, and this layer displays the area in the color green. The customer can also view the timestamp when this job is finished. This works. The customer is under the impression, filling the field would have an immediate action where the "Vlakken - gereed" layer is redrawn, refreshed. That is not the case, and should be triggered by an action. This is the question: how to get this done, without a zoom or pan interaction of the user. A browser refresh, zoom or pan action does update the layer... Maybe the whole interpretation how to solve this is wrong. If there is a better way, let me know. Hope it is clear now. Thanks Pete.
... View more
03-06-2020
03:28 AM
|
0
|
2
|
2986
|
|
POST
|
Hi John, Thank you for your help. Really appreciated! I changed the CodePen according to your suggestions, but unfortunately it doesn't make any difference. I changed the layer from the second ("Vlakken - gereed") to the first ("Vlakken") otherwise the Date value field will not get written. What I don't understand is that the Featurelayer ID is not the long ID number from the ArcGIS online portal, but anyhow. Seems the reference is correct. Still the same problem, the graphic is not updated with a refresh(). Only using the zoom buttons, or pan the map.
... View more
03-04-2020
12:49 PM
|
0
|
4
|
2986
|
|
POST
|
Hi John, that is correct, but using this: webMap.findLayerById('b7408a1c740d401288521f3834088778') does not work. b7408a1c740d401288521f3834088778 is the id of the Featurelayer in ArcGIS online.
... View more
03-04-2020
10:56 AM
|
0
|
6
|
11452
|
|
POST
|
OK the CodePen is working. https://codepen.io/powerm/pen/BaNwNzd?editors=1010 The featurelayer has 2 layers. One layer has 4 polygons with colors Purple, Olive, Red and Blue. Always visible. The second layer has the same polygons, in the color green, but initial invisible because of a filter setting. The filter is set, so the layer polygon is invisible depending of a value in a Dat_uitv field. No value, no polygon visible. A valid date value, a green polygon visible. The goal is that a polygon can be clicked, a timestamp will be set in the Dat_uitv field in the FeatureLayer. This results in a visible second layer by a green color. This works for 3 polygons, the purple one excluded. When these 3 polygons are clicked, the Dat_uitv belonging to the graphic is set with the actual date/time stamp. For this sample, a second click on the polygon, removes the date and clears the Dat_uitv field, so the polygon will have only layer visible, the original color. You can toggle as much as you like. So, by clicking on the polygon the date is constructed and returned to ArcGIS online through the ApplyEdits() function. This works like a charm, except, the screen is not updated, and a call to refresh() does not help. When the polygon is clicked, and the screen is redrawn, the polygon shows the second layer, because the date field Dat_uitv, has a valid date value. The only 2 ways to force the graphics to show the correct layer, is a zoom in / zoom out, or pan the polygons uit of the screen, and pan back. I am looking for a way to update the screen, so I see the correct layers directly after a click on the polygon. Currently I made a function where I zoom the screen but that is pretty ridiculous, because you need a delay etc. etc. I would be very pleased if I can get directions how a direct screen update, refresh, redrawn, can be achieved by a function or command. I do not want to redraw the whole FeatureLayer, because this is just a sample with a few field. The Featurelayer for a client has hundreds of polygons...
... View more
03-04-2020
08:55 AM
|
0
|
8
|
11452
|
|
POST
|
OK, you are right. I will ask my customer to make a map public, put up the Codepen and we can go from there. Thank you all for the replies.
... View more
03-04-2020
12:46 AM
|
0
|
0
|
11452
|
|
POST
|
refresh() method does not update the graphics in the map....
... View more
03-02-2020
08:57 AM
|
0
|
1
|
11452
|
|
POST
|
We have a WebMap with a FeatureLayer. The FeatureLayer has 2 sublayers. One has areas (polygons) where you can click on, the other layer should be visible after a click on the area. This is accomplished by a filter. If a field in the FeatureLayer.attributes is filled with a value, the polygon is visible in the color defined in ArcGIS online portal. In the Javascript code I return a value in the specific field. That works. The refresh() command does not update the polygon on the screen. The issue is that I have to reload the browser to see the change on the screen. The layer is updated by using the zoom buttons, but I can't find a method to refresh the layer in code, or even better, refresh the polygon. I made a silly hidescreen -> zoom in -> zoom out -> show screen function to have the layer refreshed by controlling the zoom buttons, but I can't imagine there are no other options. Found various similar questions in this community portal, tried all suggestions but there is no success. Who has a solution? Appreciated.
... View more
03-02-2020
04:51 AM
|
0
|
14
|
14980
|
|
POST
|
Like to add custom buttons on the map with similar styling as the zoom buttons. Found this example: var element = document.createElement('div'); element.className = "esri-icon-collection esri-widget--button esri-widget esri-interactive home"; view.ui.add(element, "top-right"); View is a map view. This works and adds a button on the right top side of the Webmap. The classname used is: esri-icon-collection esri-widget--button esri-widget esri-interactive home How can I construct a similar classname for an other icon? I am looking for all possible classnames, so I can choose what buttons I want to use like a close button. I can't find the article explaining or listing all options.
... View more
02-20-2020
09:01 AM
|
0
|
2
|
4094
|
|
POST
|
Thank you Rene! Exactly, that is what I'm trying to do. It works! Appreciated!!
... View more
02-19-2020
10:34 AM
|
0
|
0
|
2353
|
|
POST
|
Hi Egge-Jan, Thank you for your reply, but it did not provide an answer on my question, or, I do not understand. Inside require(), the sample creates the carousel with maps. I would like to put a click handler on it, but that is only recognised if the function that it should call is placed outside require(). Just need to know how I can access a function inside require() from outside.
... View more
02-19-2020
08:55 AM
|
0
|
2
|
2353
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-14-2020 10:42 AM |
| Online Status |
Offline
|
| Date Last Visited |
01-31-2023
09:48 AM
|