|
POST
|
The visible property for graphics that come from a FeatureLayer is pretty much meaningless; it's really only useful for graphics in GraphicsLayers. Your query is also being sent to the service to be executed, and it returns all features that match. Because the conditions of the DE are not included, it therefore returns features 1 and 2 also. If you want the conditions of the DE to be included, you should use createQuery, and then modify the where clause with the additional conditions. Alternatively, if you just want to query the layer on the client side, which will honor your DE, then you can use queryFeatures on the layer's LayerView.
... View more
08-09-2023
12:02 PM
|
1
|
1
|
1779
|
|
POST
|
Ok, I see. Unfortunately, the API has no such flag. Attached is every use of "console" in the API, and you can see it is quite often used unconditionally. Perhaps the best alternative is to override the console object's functions in a manner as mentioned by Andrew.
... View more
08-09-2023
11:15 AM
|
0
|
1
|
3405
|
|
POST
|
You can use the filtering tools in your Developer Tools console to hide any unwanted messages, as described here and here. For example, I prefer not to be inundated with error messages about missing tiles, so I usually have the filter: -blankTile=false -esri.views.2d.layers.TileLayerView2D In your case, perhaps you could have: -identity-manager:user-aborted
... View more
08-09-2023
10:11 AM
|
0
|
0
|
3413
|
|
POST
|
In the Add a Legend to LayerList sample, you can add an opacity slider by changing the contents of the script tag beginning on line 32 to the following: require(["esri/WebMap", "esri/views/MapView", "esri/widgets/LayerList", "esri/widgets/Slider"], (
WebMap,
MapView,
LayerList,
Slider
) => {
const map = new WebMap({
portalItem: {
id: "d5dda743788a4b0688fe48f43ae7beb9"
}
});
// Add the map to a MapView
const view = new MapView({
container: "viewDiv",
map: map
});
async function defineActions(event) {
const item = event.item;
await item.layer.when();
if (item.title === "Census Tracts") {
const slider = new Slider({
min: 0,
max: 1,
precision: 2,
values: [1],
visibleElements: {
labels: true,
rangeLabels: true
}
});
item.panel = {
content: ["legend",slider],
open: true,
className: "esri-icon-sliders-horizontal",
title: "Layer Info"
};
slider.on("thumb-drag", (event) => {
const { value } = event;
item.layer.opacity = value;
});
}
}
// Add a legend instance to the panel of a
// ListItem in a LayerList instance
const layerList = new LayerList({
view: view,
listItemCreatedFunction: defineActions
});
view.ui.add(layerList, "top-right");
});
... View more
08-08-2023
04:33 PM
|
0
|
5
|
1888
|
|
POST
|
Without knowing the details of the workflow, it's impossible for me to say. What is plainly evident, though, is that your custom workflow is using the client-side projection engine, whether explicitly or behind the scenes. Perhaps it is because the service is returning results in a different coordinate system than the map, thus making projection necessary. Whatever the case, it has a problem with the first search because it hasn't loaded yet. It seems to be that by the time the second search is attempted, the projection module has fully loaded, and therefore works after that. The solution is for you to load it yourself prior to any searching taking place. Perhaps the best way to do that would be to load it before instantiating your Map control, when your application is starting up: require(["esri/map", "esri/geometry/projection", "other/modules"], function(Map, projectionEngine, otherModules) {
projectionEngine.load().then(function() {
var map = new Map({
//etc
});
});
});
... View more
08-08-2023
09:57 AM
|
1
|
1
|
2293
|
|
POST
|
This error indicates the client-side projection engine is being used before it's fully loaded. Unlike other modules which you can immediately use after bringing them in via require, define, or declare, the projection engine must be explicitly loaded as well. Loading this module is asynchronous, so is not immediately available upon calling load. You must wait until the promise returned by the load function resolves before it can be used. At a minimum, you would need something like this: require(["esri/geometry/projection"], function(projectionEngine) {
projectionEngine.load().then(function() {
//do geocoding logic
});
}); However, it would probably be better to move the importing and loading of this module into your application startup code.
... View more
08-07-2023
10:58 AM
|
0
|
3
|
2310
|
|
POST
|
I haven't found any "getScaleForBox" function in the implementation of scaleUtils, however you can achieve the same result in 3.x via scaleUtils.getScale(map, extent, spatialReference), although the 2nd and 3rd parameters aren't documented. As for 4.x, the implementation of the 3.x scaleUtils is fairly simple. Migrating the relevant part to 4.x yields something like the following: const screenDPI = 96;
function _getUnitValue(spatialReference) {
if (spatialReference) {
var wkid, wkt;
if (typeof spatialReference == "object") {
wkid = spatialReference.wkid;
wkt = spatialReference.wkt;
} else if (typeof spatialReference == "number")
wkid = spatialReference;
else if (typeof spatialReference == "string")
wkt = spatialReference;
if ((typeof wkid == "number") && (wkid >= 0))
return WKIDUnitConversion.values[WKIDUnitConversion[wkid]];
else if ((typeof wkt == "string") && (wkt.search(/^PROJCS/i) !== -1)) {
var a = /UNIT\[([^\]]+)\]\]$/i.exec(wkt);
if ((a) && (a[1]))
return parseFloat(a[1].split(",")[1]);
}
}
return 0;
}
function getScale(mapView, extent, spatialReference) {
if ((mapView) && (mapView.width)) {
var scaleExtent = extent || mapView.extent;
if (scaleExtent) {
var srUnitValue = _getUnitValue(spatialReference || scaleExtent.spatialReference);
var unitValue = ((srUnitValue) ? srUnitValue : 6370997 * Math.PI / 180);
return scaleExtent.width / mapView.width * unitValue * 39.37 * screenDPI;
}
}
return 0;
} As with 3.x, the 2nd and 3rd parameters are optional. Note that "WKIDUnitConversion" is esri/geometry/support/WKIDUnitConversion, which you'll need to include.
... View more
08-04-2023
05:53 PM
|
0
|
0
|
1149
|
|
POST
|
You'll have to get the underlying CIMSymbol reference via fetchCIMSymbol, adjust its size, and use it directly. For example, this doubles the size of the icon: var symbol = new WebStyleSymbol({
name: "tear-pin-2",
styleName: "Esri2DPointSymbolsStyle"
});
symbol.fetchCIMSymbol().then(function(cimSymbol) {
cimSymbol.data.symbol.symbolLayers.forEach(function(symbolLayer) {
symbolLayer.size = symbolLayer.size * 2;
});
view.graphics.add({
symbol: cimSymbol,
geometry: {/* etc */},
popupTemplate: {/* etc */}
});
});
... View more
08-03-2023
10:31 AM
|
1
|
0
|
1975
|
|
POST
|
If your goal is simply to display a CSV file specified from a file input, a much simpler process is possible that never even has to leave the client. You can see this in the sandbox for the sample by replacing the contents of the script tag on line 37 with the following: require([
"esri/Map",
"esri/views/MapView",
"esri/widgets/Expand",
"esri/layers/CSVLayer"
], (Map, MapView, Expand, CSVLayer) => {
document
.getElementById("uploadForm")
.addEventListener("change", (event) => {
var reader = new FileReader();
reader.addEventListener("load", function (evt) {
var blob = new Blob([evt.target.result], {type:"text/plain"});
var layer = new CSVLayer({url:URL.createObjectURL(blob)});
map.add(layer);
expand.collapse();
});
reader.readAsText(event.target.files[0]);
});
const map = new Map({
basemap: "dark-gray-vector"
});
const view = new MapView({
center: [-41.647, 36.41],
zoom: 2,
map: map,
container: "viewDiv",
popup: {
defaultPopupTemplateEnabled: true
}
});
const fileForm = document.getElementById("mainWindow");
const expand = new Expand({
expandIcon: "upload",
view: view,
content: fileForm
});
view.ui.add(expand, "top-right");
}); It loads the sample CSV you provided just fine:
... View more
07-28-2023
02:47 PM
|
1
|
0
|
2602
|
|
POST
|
It's possible you may have shortened your description for simplicity, but disabling the gamepad according to the documentation is shown here under the description of the navigation property. If you've done that and it still doesn't solve your problem, you may have to resort to overwriting the _forEachGamepad function so it doesn't cause the problem. To do so, you'd need something like this prior to creating your MapView: require(["esri/views/input/gamepad/GamepadSource"], function(g) {
g.GamepadSource.prototype._forEachGamepad = function(m) { console.warn("Prevented gamepad access..."); };
});
... View more
07-27-2023
03:29 PM
|
0
|
0
|
2907
|
|
POST
|
The issue appears to be that just because the visible property changes to true, it doesn't mean the content has yet been added to the popup, and therefore queryable through the DOM. Since the popup doesn't have the equivalent of a "content-ready" event, we have to be a little more creative. I recommend something like the following: new MutationObserver(function() {
if (popup.visible) {
var button = document.querySelector("myButtonSelector");
if ((button) && (button.dataset.addedclick != "true")) {
button.dataset.addedclick = "true"; //flag to indicate we've set the handler, so action doesn't get repeated unnecessarily
button.onclick = function() {
//do something
};
}
}
}).observe(popup.container, {childList:true,subtree:true});
... View more
07-26-2023
11:13 AM
|
0
|
0
|
1117
|
|
POST
|
If working with a literal, you must "double escape" the apostrophe: const name = "Bob\\'s";
//etc
labelExpressionInfo: {expression: `"${name}"`} Otherwise, you'll need to do the escaping in the expression itself: const name = "Bob's";
//etc
labelExpressionInfo: {expression: `Replace("${name}", "'", "\'")`}
... View more
07-26-2023
10:45 AM
|
1
|
0
|
837
|
|
POST
|
Very good; thank you also for taking the time to explain.
... View more
07-25-2023
04:42 PM
|
1
|
0
|
2188
|
|
POST
|
A lot has changed in those releases, including the removal of dojo as part of the API in 4.20. I don't remember the technical specifics of what transpired, but I ended up making my own custom replacement for the text module. It's called text.js, and I placed it within the root of my own package. The implementation is very simple: define([], function() {
return {
load: function(id, require, callback) {
var url = require.toUrl(id);
var prop = "url:" + url;
var cacheVal = require.cache[prop];
if (typeof cacheVal == "string")
callback(cacheVal);
else {
fetch(require.toUrl(id), {credentials:"include"}).then(function(response) {
response.text().then(function(text) {
require.cache[prop] = text;
callback(text);
});
});
}
}
};
}); So then, if you put this text.js file directly in the directory represented by "cuwcd", your function call would change to: require(["cuwcd/text!cuwcd/widgets/Header/header.hbs"], function(hbs) {
//etc
});
... View more
07-25-2023
03:02 PM
|
1
|
0
|
1356
|
|
POST
|
I haven't seen the documentation you're referring to that involves the letter 'N', so not sure if it will work or not. However, what I can help you with is inserting that letter into your Search tool's queries. Although it's about a completely different issue, this thread shows multiple approaches of adjusting the query created by the Search tool before it's sent. Perhaps using one of those approaches will accomplish what you're trying to do. For example, if you go with the first suggested approach, you would have something like this at line 5 instead: query.where = query.where.replace(/ LIKE '/g, " LIKE 'N");
... View more
07-25-2023
10:09 AM
|
1
|
0
|
2205
|
| 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 |