|
POST
|
It appears that you are using the Editor widget, so I think what you want is to capture the "create" event of the underlying SketchViewModel instance. In that case, it would be something like: editor.viewModel.sketchViewModel.on("create", function(evt) {
if (evt.state == "complete") {
//do something with evt.graphic here
}
});
... View more
12-12-2022
10:08 AM
|
0
|
0
|
1200
|
|
POST
|
As mentioned in this post, 4.x doesn't give direct access to the underlying data (i.e. graphics) of a FeatureLayer; basically, your graphic reference is a copy of the data it's using internally. There are other options for dynamically setting visibility; perhaps the best is to use the definitionExpression property (e.g. "id<>1").
... View more
12-07-2022
09:57 AM
|
0
|
0
|
1884
|
|
POST
|
The problem indicated by the error message occurs when accessing the graphics property of the Search widget's view property. Basically it's saying the view's graphics property is undefined. I can only think of two cases where this could happen: (1) the view is not ready when this occurs, or (2) the widget's view property is not set to an instance of MapView (or SceneView). When you create your Search widget, it probably looks something like: var search = new Search({
//etc
view: view
//etc
}); What are you passing to the view property?
... View more
12-06-2022
05:23 PM
|
0
|
0
|
2888
|
|
POST
|
The problem is that querySelector only returns the first matching element, but you want all matching elements. Instead, you can use querySelectorAll. The last part would then go something like this instead: const sublayersElements = document.querySelectorAll(".list_item");
for (var x = 0; x < sublayersElements.length; x++) {
sublayersElements[x].addEventListener("click", (event) => {
const id = event.target.getAttribute("data-id");
if (id) {
const sublayer = layer.findSublayerById(parseInt(id));
const node = document.querySelector(".list_item[data-id='" + id + "']");
sublayer.visible = !sublayer.visible;
node.classList.toggle("visible-layer");
}
});
}
... View more
12-06-2022
08:40 AM
|
1
|
1
|
1416
|
|
POST
|
The definition of removeUniqueValueInfo was modified in 4.25, but this bug continues to exist...
... View more
11-23-2022
01:44 PM
|
0
|
2
|
5941
|
|
BLOG
|
The new feature "Categorize unique values into groups" looks great, and I'd like to put it to use on some layers with redundant symbols, but have a few questions. Background: in our products, we typically have a configuration file where admins specify what layers should be loaded into the map, as well as various settings related to those layers. This includes the ability to specify renderer information, and we require that it be specified in JSON format, so that at runtime, the renderer can be instantiated via rendererJsonUtils.fromJSON, which works great for both 3.x and 4.x-based products. There is no definitive reference to these JSON objects (structure, property names, etc) in the JavaScript API documentation, but there is here. That page hasn't been updated for awhile though, and therefore doesn't include any information about how to specify the unique value groups supported by 4.25. In order to figure out the JSON structure for these groups, I went to the new "Unique value groups with headings" sample, and added the following line to get the JSON: console.info(JSON.stringify(layer.renderer.toJSON())); I've added the output at the end of this post for reference. Reverse engineering the structure in this way and designing against it seems like an unsafe idea since the structure is undocumented, and therefore possibly subject to arbitrary change. Will the renderer JSON documentation be updated soon? Are any changes to the new structure seen in 4.25 expected? Looking at the output (below), I see that "uniqueValueGroups" and "uniqueValueInfos" are both specified, and therefore redundant, and I would like to keep my config files as small as possible. If I removed the uniqueValueGroups, I would expect it to work the same as previously in both 3.x and 4.x. On the other hand, I assume I can remove uniqueValueInfos and 4.25-based implementations would still have what's necessary in order to fully instantiate the renderer...is that true? {
"type": "uniqueValue",
"field1": "zonecode",
"uniqueValueGroups": [{
"heading": "Commercial",
"classes": [{
"label": "C-1 | Neighborhood Commercial",
"symbol": {
"type": "esriSFS",
"color": [189, 145, 145, 255],
"style": "esriSFSSolid"
},
"values": [
["C-1"]
]
}, {
"label": "C-2 | Community Commercial",
"symbol": {
"type": "esriSFS",
"color": [255, 179, 219, 255],
"style": "esriSFSSolid"
},
"values": [
["C-2"]
]
}, {
"label": "C-3 | Major Commercial",
"symbol": {
"type": "esriSFS",
"color": [255, 0, 0, 255],
"style": "esriSFSSolid"
},
"values": [
["C-3"]
]
}]
}, {
"heading": "Office",
"classes": [{
"label": "GO | General Office",
"symbol": {
"type": "esriSFS",
"color": [176, 196, 222, 255],
"style": "esriSFSSolid"
},
"values": [
["GO"]
]
}, {
"label": "E-1 | Campus Employment",
"symbol": {
"type": "esriSFS",
"color": [230, 230, 230, 255],
"style": "esriSFSSolid"
},
"values": [
["E-1"]
]
}, {
"label": "E-2 | Mixed Use Employment",
"symbol": {
"type": "esriSFS",
"color": [255, 20, 255, 255],
"style": "esriSFSSolid"
},
"values": [
["E-2"]
]
}]
}, {
"heading": "Residential",
"classes": [{
"label": "R-1 | Low-Density Residential",
"symbol": {
"type": "esriSFS",
"color": [255, 255, 224, 255],
"style": "esriSFSSolid"
},
"values": [
["R-1"]
]
}, {
"label": "R-1.5 | Rowhouse",
"symbol": {
"type": "esriSFS",
"color": [255, 255, 0, 255],
"style": "esriSFSSolid"
},
"values": [
["R-1.5"]
]
}, {
"label": "R-2 | Medium-Density Residential",
"symbol": {
"type": "esriSFS",
"color": [240, 230, 140, 255],
"style": "esriSFSSolid"
},
"values": [
["R-2"]
]
}, {
"label": "R-3 | Limited High-Density Residential",
"symbol": {
"type": "esriSFS",
"color": [255, 214, 0, 255],
"style": "esriSFSSolid"
},
"values": [
["R-3"]
]
}, {
"label": "R-4 | High-Density Residential",
"symbol": {
"type": "esriSFS",
"color": [255, 166, 0, 255],
"style": "esriSFSSolid"
},
"values": [
["R-4"]
]
}]
}, {
"heading": "Industrial",
"classes": [{
"label": "I-2 | Light-Medium Industrial",
"symbol": {
"type": "esriSFS",
"color": [219, 112, 214, 255],
"style": "esriSFSSolid"
},
"values": [
["I-2"]
]
}, {
"label": "I-3 | Heavy Industrial",
"symbol": {
"type": "esriSFS",
"color": [148, 112, 219, 255],
"style": "esriSFSSolid"
},
"values": [
["I-3"]
]
}]
}, {
"heading": "Open Space",
"classes": [{
"label": "NR | Natural Resource",
"symbol": {
"type": "esriSFS",
"color": [125, 252, 0, 255],
"style": "esriSFSSolid"
},
"values": [
["NR"]
]
}, {
"label": "PRO | Park, Recreation & Open Space",
"symbol": {
"type": "esriSFS",
"color": [0, 255, 128, 255],
"style": "esriSFSSolid"
},
"values": [
["PRO"]
]
}]
}, {
"heading": "Other",
"classes": [{
"label": "AG | Agricultural",
"symbol": {
"type": "esriSFS",
"color": [219, 166, 33, 255],
"style": "esriSFSSolid"
},
"values": [
["AG"]
]
}, {
"label": "PL | Public Land",
"symbol": {
"type": "esriSFS",
"color": [0, 191, 255, 255],
"style": "esriSFSSolid"
},
"values": [
["PL"]
]
}, {
"label": "S | Special Area",
"symbol": {
"type": "esriSFS",
"color": [161, 237, 237, 255],
"style": "esriSFSSolid"
},
"values": [
["S-DW"],
["S-DR"],
["S-RP"],
["S-JW"],
["S-RN"],
["S-WS"],
["S-CN"],
["S-HB"],
["S-F"],
["S-W"],
["S-E"],
["S-C"]
]
}, {
"label": "S-H | Historic",
"symbol": {
"type": "esriSFS",
"color": [0, 0, 204, 255],
"style": "esriSFSSolid"
},
"values": [
["S-H"]
]
}]
}],
"uniqueValueInfos": [{
"label": "C-1 | Neighborhood Commercial",
"symbol": {
"type": "esriSFS",
"color": [189, 145, 145, 255],
"style": "esriSFSSolid"
},
"value": "C-1"
}, {
"label": "C-2 | Community Commercial",
"symbol": {
"type": "esriSFS",
"color": [255, 179, 219, 255],
"style": "esriSFSSolid"
},
"value": "C-2"
}, {
"label": "C-3 | Major Commercial",
"symbol": {
"type": "esriSFS",
"color": [255, 0, 0, 255],
"style": "esriSFSSolid"
},
"value": "C-3"
}, {
"label": "GO | General Office",
"symbol": {
"type": "esriSFS",
"color": [176, 196, 222, 255],
"style": "esriSFSSolid"
},
"value": "GO"
}, {
"label": "E-1 | Campus Employment",
"symbol": {
"type": "esriSFS",
"color": [230, 230, 230, 255],
"style": "esriSFSSolid"
},
"value": "E-1"
}, {
"label": "E-2 | Mixed Use Employment",
"symbol": {
"type": "esriSFS",
"color": [255, 20, 255, 255],
"style": "esriSFSSolid"
},
"value": "E-2"
}, {
"label": "R-1 | Low-Density Residential",
"symbol": {
"type": "esriSFS",
"color": [255, 255, 224, 255],
"style": "esriSFSSolid"
},
"value": "R-1"
}, {
"label": "R-1.5 | Rowhouse",
"symbol": {
"type": "esriSFS",
"color": [255, 255, 0, 255],
"style": "esriSFSSolid"
},
"value": "R-1.5"
}, {
"label": "R-2 | Medium-Density Residential",
"symbol": {
"type": "esriSFS",
"color": [240, 230, 140, 255],
"style": "esriSFSSolid"
},
"value": "R-2"
}, {
"label": "R-3 | Limited High-Density Residential",
"symbol": {
"type": "esriSFS",
"color": [255, 214, 0, 255],
"style": "esriSFSSolid"
},
"value": "R-3"
}, {
"label": "R-4 | High-Density Residential",
"symbol": {
"type": "esriSFS",
"color": [255, 166, 0, 255],
"style": "esriSFSSolid"
},
"value": "R-4"
}, {
"label": "I-2 | Light-Medium Industrial",
"symbol": {
"type": "esriSFS",
"color": [219, 112, 214, 255],
"style": "esriSFSSolid"
},
"value": "I-2"
}, {
"label": "I-3 | Heavy Industrial",
"symbol": {
"type": "esriSFS",
"color": [148, 112, 219, 255],
"style": "esriSFSSolid"
},
"value": "I-3"
}, {
"label": "NR | Natural Resource",
"symbol": {
"type": "esriSFS",
"color": [125, 252, 0, 255],
"style": "esriSFSSolid"
},
"value": "NR"
}, {
"label": "PRO | Park, Recreation & Open Space",
"symbol": {
"type": "esriSFS",
"color": [0, 255, 128, 255],
"style": "esriSFSSolid"
},
"value": "PRO"
}, {
"label": "AG | Agricultural",
"symbol": {
"type": "esriSFS",
"color": [219, 166, 33, 255],
"style": "esriSFSSolid"
},
"value": "AG"
}, {
"label": "PL | Public Land",
"symbol": {
"type": "esriSFS",
"color": [0, 191, 255, 255],
"style": "esriSFSSolid"
},
"value": "PL"
}, {
"label": "S | Special Area",
"symbol": {
"type": "esriSFS",
"color": [161, 237, 237, 255],
"style": "esriSFSSolid"
},
"value": "S-DW"
}, {
"label": "S | Special Area",
"symbol": {
"type": "esriSFS",
"color": [161, 237, 237, 255],
"style": "esriSFSSolid"
},
"value": "S-DR"
}, {
"label": "S | Special Area",
"symbol": {
"type": "esriSFS",
"color": [161, 237, 237, 255],
"style": "esriSFSSolid"
},
"value": "S-RP"
}, {
"label": "S | Special Area",
"symbol": {
"type": "esriSFS",
"color": [161, 237, 237, 255],
"style": "esriSFSSolid"
},
"value": "S-JW"
}, {
"label": "S | Special Area",
"symbol": {
"type": "esriSFS",
"color": [161, 237, 237, 255],
"style": "esriSFSSolid"
},
"value": "S-RN"
}, {
"label": "S | Special Area",
"symbol": {
"type": "esriSFS",
"color": [161, 237, 237, 255],
"style": "esriSFSSolid"
},
"value": "S-WS"
}, {
"label": "S | Special Area",
"symbol": {
"type": "esriSFS",
"color": [161, 237, 237, 255],
"style": "esriSFSSolid"
},
"value": "S-CN"
}, {
"label": "S | Special Area",
"symbol": {
"type": "esriSFS",
"color": [161, 237, 237, 255],
"style": "esriSFSSolid"
},
"value": "S-HB"
}, {
"label": "S | Special Area",
"symbol": {
"type": "esriSFS",
"color": [161, 237, 237, 255],
"style": "esriSFSSolid"
},
"value": "S-F"
}, {
"label": "S | Special Area",
"symbol": {
"type": "esriSFS",
"color": [161, 237, 237, 255],
"style": "esriSFSSolid"
},
"value": "S-W"
}, {
"label": "S | Special Area",
"symbol": {
"type": "esriSFS",
"color": [161, 237, 237, 255],
"style": "esriSFSSolid"
},
"value": "S-E"
}, {
"label": "S | Special Area",
"symbol": {
"type": "esriSFS",
"color": [161, 237, 237, 255],
"style": "esriSFSSolid"
},
"value": "S-C"
}, {
"label": "S-H | Historic",
"symbol": {
"type": "esriSFS",
"color": [0, 0, 204, 255],
"style": "esriSFSSolid"
},
"value": "S-H"
}]
}
... View more
11-23-2022
01:21 PM
|
0
|
0
|
1011
|
|
POST
|
OP is evidently talking about this sample, and modifying the IdentifyParameters. The behavior appears to be related to the new MapImageLayer highlight feature of 4.25. It appears there's an expectation that setting returnGeometry to true will automatically highlight the feature on the map, but the API has never worked this way. One must manually create a symbol and add the graphic to MapView.graphics or something similar. However, OP has noticed that when specifying returnGeometry and sublayers, the feature does get highlighted (new to 4.25). Under the hood, the identify operation retrieves the features as graphic objects (as expected), but when sublayers is specified within the IdentifyParameters, the operation sets an undocumented property called "sourceLayer" on each returned graphic with the related Sublayer object associated with that graphic's layer. The graphic having this sourceLayer property specified is what triggers the highlight when the graphic is added to the Popup. This can be demonstrated by adding the following line immediately above original line 148 (return feature): feature.sourceLayer = identifyLayer.sublayers.getItemAt(result.layerId); ...and the following line above original line 80: params.returnGeometry = true; The subsequent highlight operation causes the additional query request. I would agree with OP in that the query is unnecessary since the geometry already exists on the client, but it is what it is. Regardless, though, the query is often worse that it looks. It should only retrieve the specified feature by its objectID value, but it seems more often than not, it doesn't include the objectID in the request, and therefore requests all features in the layer (see attachment)...which is really bad. I've also seen the additional calls to export mentioned by the OP, but it seems kind of sporadic (not in the attachment for that run), but never actually does anything useful when it does execute.
... View more
11-23-2022
11:19 AM
|
2
|
1
|
4386
|
|
POST
|
This is my least favorite change with 4.25 thus far. The Search widget has used "contains" logic for many years, and to suddenly change it up to "starts with" logic without some kind of means by which we can turn it on or off (like a configuration parameter or something) is a bit of a curveball out of nowhere. Anyhow, the heart of the workaround I've devised for 4.25 intercepts the process where the associated layer's queryFeatures function is called, and "fixes" the where clause. It looks something like this: var source = new LayerSearchSource(options);
source.layer.defaultQueryFeatures = source.layer.queryFeatures;
source.layer.queryFeatures = function(query) {
if ((query) && (typeof query.where == "string"))
query.where = query.where.replace(/ LIKE '/g, " LIKE '%");
return this.defaultQueryFeatures.apply(this, arguments);
}; Note that "LayerSearchSource" is esri/widgets/Search/LayerSearchSource. Note also that there are some unlikely cases where this could cause unintended side effects, because any time the layer's queryFeatures function is called, any instances of " LIKE '" in the query's where property will be changed to " LIKE '%"...so you might consider how the layer object is being used, and if other functionality executes LIKE-based queries. My workaround for 3.42 is "somewhat" cleaner in that the where clause is only altered for queries executed by the widget itself: var search = new Search(options, srcNode);
search._defaultWhereClause = search._whereClause;
search._whereClause = function() {
var wc = this._defaultWhereClause.apply(this, arguments);
return ((typeof wc == "string") ? wc.replace(/ LIKE '/g, " LIKE '%") : wc);
};
... View more
11-22-2022
04:50 PM
|
1
|
0
|
3326
|
|
POST
|
In the allowedReferers of my proxy.config file, the servers listed don't have the "https://" prefix, so maybe try just "www.mydomain.com/*"
... View more
11-22-2022
09:35 AM
|
0
|
0
|
3570
|
|
POST
|
The problem isn't so much with hitTest as it is with the workflow. On a click, the popup is natively opened for the clicked feature, and your handler simply updates its location (without need). Then, as applyEdits is repeatedly called, it seems the location gets out of sync with the features value (which was natively set). I recommend making the following adjustments (the first line of each has not been changed from what you wrote, but the rest have): layer.applyEdits(edits).then((res) => {
if ((view.popup.visible) && (popupID === graphicForUpdate.attributes.ObjectID))
view.popup.location = graphicForUpdate.geometry.centroid;
}); view.on('click', (event) => {
popupID = 0;
view.hitTest(event).then((hitResult) => {
if ((Array.isArray(hitResult.results)) && (hitResult.results.length !== 0) && (hitResult.results[0].type == "graphic"))
popupID = hitResult.results[0].graphic.attributes.ObjectID;
});
});
... View more
11-10-2022
12:24 PM
|
0
|
1
|
1489
|
|
POST
|
If I'm understanding your question properly, it seems to me that UniqueValueRenderer.getUniqueValueInfo is the key to what you're trying to do. For example: layer.renderer.getUniqueValueInfo(someGraphic).then(function(uniqueValueInfo) {
var symbol = uniqueValueInfo.symbol;
//do whatever with the symbology for "someGraphic" here
});
... View more
11-04-2022
11:47 AM
|
0
|
0
|
941
|
|
POST
|
The call to hitTest as you have it will query every single layer in the view, and the graphic will be added to the map if any feature from any layer in the view intersects the hit point. Here, I'm assuming your county boundaries layer is a polygon, and so the hitTest is intersecting that polygon. Therefore, since the hitTest intersects a feature, your graphic is placed on the map. You need to tell the hitTest method to only query against your streets layer, and that can be done in the second argument (called "options" in the documentation) to hitTest. For example (assuming you have a reference to your layer with a variable named "streetsLayer"): view.hitTest(evt, {include:streetsLayer}).then(({results}) => {
if (results.length) {
view.graphics.removeAll();
view.graphics.add(graphic);
}
});
... View more
10-31-2022
11:11 AM
|
2
|
1
|
1315
|
|
POST
|
I don't think you're going to be able to avoid the overkill you mentioned, because using a GraphicsLayer is about the only way to accomplish what you're trying to do. You might consider simply removing the borders from the symbols so they don't appear to be split up. After all, if you have two regions right next to each other, their borders will overlap, and may not be the look you're trying to achieve. The problem you're having with slivers and gaps after unioning could be related to the fact that FeatureLayers retrieve generalized geometries from the server based upon the current map scale. This helps reduce the amount of network traffic and processing required in order to display a feature, but it also means the client doesn't usually have the true feature geometry. If you want to union these features together as neatly as possible, you'll need to make sure you're retrieving the actual geometries from the server. This would likely require the use of the objects in the esri/rest namespace (query, etc).
... View more
10-27-2022
10:18 AM
|
1
|
1
|
3116
|
|
POST
|
I don't know the answer to that. Since it's off-topic, you might consider posting it as a separate question for greater visibility.
... View more
10-25-2022
10:35 AM
|
0
|
0
|
3764
|
|
POST
|
The following works in 4.24. As far as I can tell, it should also work in 4.22, but I haven't tested... identityManager.on("dialog-create", function() {
identityManager.dialog.visible = false;
window.setTimeout(function() {
identityManager.dialog.content.emit("cancel", {});
}, 250);
});
... View more
10-21-2022
05:49 PM
|
3
|
0
|
1594
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 03-19-2024 10:37 AM | |
| 1 | 03-31-2026 02:34 PM | |
| 1 | 12-09-2025 09:35 AM | |
| 2 | 12-09-2025 09:06 AM | |
| 1 | 11-26-2025 12:29 PM |