|
POST
|
Good Day This is how I disable the console messages. This allows you to turn off different message types, so in production you can disable all logging, which is generally a good idea. const disableErr: boolean = false;
const disableLog: boolean = false;
const disableTime: boolean = true;
if (window && disableLog) {
window.console.log = () => {
};
window.console.table = () => {
};
window.console.info = () => {
};
}
if (window) {
if (disableErr) {
window.console.error = () => {
};
}
if (disableTime) {
window.console.time = () => {
};
window.console.timeLog = () => {
};
window.console.timeEnd = () => {
};
}
} Cheers
... View more
08-09-2023
11:06 AM
|
0
|
0
|
2234
|
|
POST
|
Good Day I'm using "@arcgis/core": "4.27.6" I think I found a bug in the querying logic when setting a definition expression (DE). Assume I have a layer and I set the DE to 'a = 1 OR a =2', and two of the X features are now shown. If I run another query on the map: 'a = 3', and get back a feature / geometry, why is the visible flag still true when the feature isn't visible? Should I be able to use a DE as a first pass filter that's constant, and then on top of that apply more filters using queries? This is a code sample of what I'm doing: Definition Expression Stage, assume query: 'a = 1 OR a = 2': this._view?.map?.layers?.forEach((layer) => {
if (layer?.type === 'feature' && !layer?.id.includes('meta-')) {
layer.definitionExpression = query;
}
} Running the second query, assume mapQuery is: 'a = 3': const query = {
where: mapQuery,
outFields: ['*'],
returnGeometry: true
}
const visibleFeatures: Graphic[] = [];
this._view.when(() => {
this._view.map.layers.forEach((layer) => {
if (layer.type === 'feature') {
layer.queryFeatures(query).then((queryRes) => {
queryRes.features?.forEach((feature) => {
if (feature.visible) {
visibleFeatures.push(feature);
}
})
r(visibleFeatures);
}).catch((error) => {
console.log(error);
j(error);
})
}
})
}) When I look for anything but a 1 or 2, they aren't visible on the map, so that flag shouldn't be set. Thanks
... View more
08-09-2023
10:41 AM
|
0
|
2
|
1435
|
|
POST
|
Good Day Is it possible to have one render setting for the map, but if you print it, you can change the render setting? The problem I'm running into is that when you print a large map, it's just a cluttered mess, unless I thin out the geometries. When I thin out the geometries, the cluttered issue goes away, BUT, the look of the map isn't usually ideal. If you have a very large network it can be fine, but for smaller networks it just looks terrible. To get around this problem, I was wondering if I can set a render setting that only be applied when you print. Thanks
... View more
07-13-2023
11:24 AM
|
0
|
0
|
509
|
|
POST
|
Thanks for the suggestion. The issue, I was missing: https://js.arcgis.com/4.26/@arcgis/core/assets/esri/core/workers/RemoteClient.js in script-src. Once I added that the workers were able to load and everything, so far, has been working great. Thanks
... View more
05-16-2023
08:23 AM
|
0
|
0
|
3184
|
|
POST
|
Good Day I'm trying to configure a CSP header, and every time I try to load one of the maps, it just doesn't render, this is what I get: This is my CSP setting: frame-ancestors
'self';
block-all-mixed-content;
default-src
'self';
script-src
'self'
'report-sample'
'unsafe-inline'
'unsafe-eval'
style-src
'self'
'report-sample'
'unsafe-inline'
js.arcgis.com
object-src
'none';
frame-src
'self'
child-src
'self';
img-src
'self'
data:
blob:
*.arcgis.com
font-src
'self'
data:
js.arcgis.com;
connect-src
'self'
*.arcgisonline.com
*.arcgis.com
manifest-src
'self';
base-uri
'self';
form-action
'self';
media-src
'self'
prefetch-src
'self';
worker-src
'self'
blob:; What do I need to add, or change? Thanks
... View more
05-12-2023
12:42 PM
|
0
|
2
|
3222
|
|
POST
|
I love this opinion, and you're absolutely right that context, and situational awareness is key! Far too often a tool will point out you're missing setting (or header), X, Y and Z, when X, Y and Z aren't actually useful or productive. A good example is setting a CSP header! CSP headers are very important when you have to strictly lock down where resources can load from, which for a bank is vital, but for most applications, isn't a good idea. If anyone suggests you need to lock down everything down like it's a high security, mission-critical vault, then ask why? In almost all cases they want things locked down so they can have "green A" show up, or so the report can list you have X, or Y, when in reality neither matter. Spending 20 extra hours to move from a B to an A, on a tool that doesn't understand context, only wasted 20 hours, unless you can defend putting the work in beforehand. People will generally spend X hours locking down everything, like it's a 100-foot thick concrete reinforced super max prison, without first taking the broken screen door off the front, that was the problem all along.
... View more
05-12-2023
10:04 AM
|
0
|
0
|
4666
|
|
POST
|
Good Day I have the Sketch Widget active on my map, and if I use the Draw tools, the "create" event will send a signal, and I can query the features without issue: sketchWidget.on("create", async (event) => {
if (event.state === "complete") {
this._view.graphics.removeAll();
const geometries= this.sketchLayer.graphics.map((graphic) => {
return graphic.geometry
});
const queryGeometry = await geometryEngineAsync.union(geometries.toArray());
this.selectFeatures(queryGeometry);
}
}); When I use lasso or rectangle select tool, no signal is thrown, that I can find. Oddly enough, if I use the "Select Feature" option, to select a single feature, the click handler on the view works fine. What should I do, to get signals from the lasso and rectangle selection options? Thanks
... View more
05-05-2023
12:04 PM
|
0
|
0
|
772
|
|
POST
|
Good Day I'm not sure the right way to file this issue, but can someone please update the documentation for View / Map Destroy? https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#destroy Can a statement be added that says something like: “Please note, the service / web workers which are allocated from the map / view, will not be destroyed. This is intentional and by design <insert reason here>”. I understand that calling view.destroy() and map.destroy() will not release the workers, and that's fine. It would be helpful if the above comment was added into the documentation, because it's not evident from the description, which would imply they should be. “Destroys the view, and any associated resources, including its map, popup and UI elements. These can no longer be used once the view has been destroyed. To prevent these components from being destroyed, remove them from the view before calling destroy().” Thanks
... View more
03-24-2023
09:44 AM
|
0
|
2
|
953
|
|
POST
|
Good Day I found a solution! I was previous performing a featureEffect query to show and hide layers, setting excluded layers to opacity 0%. This was working great until yesterday when we noticed I could still interact with the features (my fault, I should have thought about that!). I decided to move from the featureEffect query to the layerView filter query, and now all PrintTasks are showing up with legends intact. It seems for some odd reason that the “featureEffect” was causing the problem. Hopefully this can help others in the future! Thanks for your help.
... View more
02-23-2023
08:22 AM
|
1
|
2
|
2168
|
|
POST
|
Thanks for the suggestion, I'm kind of baffled as to why I didn't think of that myself. The “featureCollection” object is missing when the legend isn't present. When I don't have the “featureCollection”, I have “imageData”, and I think that's what is causing the problem. Should I be adding in LegendLayers into the Print Parameters? https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-LegendLayer.html If so, what do I pass for layerId and subLayerId? I would assume I get the layerId with: const legendLayers = []
this._view.map.layers.forEach((layer) => {
let legendLayer = new LegendLayer();
legendLayer.layerId = layer.id;
legendLayer.subLayerId = [] // NOTE: I don't know what to pass for this
}); I already to do this, but I keep getting three boxes, Red, Green and Blue showing up, which I think it due to incorrectly assembling the legend layers array. If run a featureEffect filter, or manually replace the render setting on a feature layer with layer.renderer = newRenderSetting, will that cause an issue? Thanks!
... View more
02-16-2023
10:28 AM
|
0
|
0
|
2199
|
|
POST
|
If it matters, this is buildRenderSetting private buildRenderSettingForLayer(geometryType: string = 'polyline'): UniqueValueRenderer {
let renderSetting;
if (this.gisFlag) {
if (geometryType === 'point' && this.tabIndex === 0) {
// NOTE: The first tab in the GIS Page is a "Picture Marker"
renderSetting = this.render.getUniqueRenderSetting(`picture-point`);
} else {
// NOTE: Handle lines / polygons
renderSetting = this.render.getUniqueRenderSetting(geometryType);
}
} else {
// NOTE: Handle lines / polygons
renderSetting = this.render.getUniqueRenderSetting(geometryType);
}
if (this.gisFlag) {
const gisFieldInformation = this.whichGISField();
renderSetting.field = gisFieldInformation.field;
renderSetting.valueExpression = null;
if (gisFieldInformation.valueExpression !== '') {
renderSetting.field = '';
renderSetting.valueExpression = gisFieldInformation.valueExpression;
this.hostLayerState = this.render.getLegend(gisFieldInformation.legendType);
this.hostLayerState.forEach((layerState) => {
layerState.field = gisFieldInformation.legendField;
})
}
} else if (this.performance) {
if (!this._year) {
this._year = 2022;
}
renderSetting.field = '';
const valueExpression =
this.render.getValueExpression('CONDITION');
renderSetting.valueExpression =
valueExpression.replaceAll('FIELD_REPLACE_TEXT', `$feature.F${this._year}`);
} else if (this._capitalPlan || this._alignment) {
renderSetting.field = `F${this._year}`;
renderSetting.valueExpression = '';
}
console.log('Render Setting - Build Render Setting');
console.log(_.cloneDeep(renderSetting));
return renderSetting;
}
... View more
02-15-2023
07:05 AM
|
0
|
0
|
2230
|
|
POST
|
Good Day API Version 4.25.5 "@arcgis/core": "4.25.5",
"@esri/arcgis-rest-auth": "3.6.0",
"@esri/arcgis-rest-feature-layer": "3.6.0",
"@esri/arcgis-rest-portal": "3.6.0",
"@esri/arcgis-rest-request": "3.6.0",
"@esri/arcgis-rest-types": "3.6.0",
"@esri/calcite-components": "1.0.2", All the layers are Feature Layers, here is the way they're set up: private buildFeatureSettings(geometryType: string, data: any, metaLayer: boolean = false): any {
const layerLabelClass = new LabelClass({
labelExpressionInfo: {expression: '$feature.label'},
symbol: {
type: 'text',
color: 'black',
haloSize: 1,
haloColor: 'white'
}
});
const renderSetting = this.buildRenderSettingForLayer(geometryType);
return {
fields: metaLayer ? this._metaFields : this._fields,
geometryType: geometryType,
globalIdField: 'assetSectionId',
id: metaLayer ? `meta-${data[0].attributes.layerId}` : this.generateUniqSerial(),
labelingInfo: [layerLabelClass],
objectIdField: 'ObjectID',
outFields: ['*'],
renderer: renderSetting,
source: data,
title: '',
visible: true
}
} “renderSetting” is the same for all layers, it's ~160 Unique Value Render Settings. One thing I have noticed is that the layers which don't use “valueExpressions” are always showing up, I only see this odd behaviour when I use “valueExpressions”, but it's not constant. Any help would be greatly appreciated 🙂 Thanks
... View more
02-15-2023
07:03 AM
|
0
|
0
|
2230
|
|
POST
|
Good Day I have a weird issue where my PrintTask outputs are missing legend, sometimes, but not others, and I can't find a pattern as to why. I have a unique value render setting with ~160 different values in it, and on most of the maps I use a valueExpression to set the renderer. If I take two maps which use the same valueExpression, literally the same one, and compare them, one will generate with legends, and the other won't. Map 1: Map 2: The valueExpression: When($feature.aType == 3 && $feature.ci > -10 && $feature.ci <= 40, 'condition_3_Crititcal',$feature.aType == 3 && $feature.ci > 40 && $feature.ci <= 50, 'condition_3_Poor',$feature.aType == 3 && $feature.ci > 50 && $feature.ci <= 65, 'condition_3_Fair',$feature.aType == 3 && $feature.ci > 65 && $feature.ci <= 90, 'condition_3_Good',$feature.aType == 3 && $feature.ci > 90 && $feature.ci <= 99, 'condition_3_Excellent',$feature.aType == 3 && $feature.ci > 99 && $feature.ci <= 100, 'condition_3_Perfect',$feature.aType == 3 && $feature.ci > -10 && $feature.ci <= 0, 'condition_3_Not Defined','condition_Not Defined') That is the valueExpression shared by both maps, the first will generate a legend, the second won't. This is my print function: public printMap(): void {
const titleText = 'Map: ';
/* let layerLegend = new LegendLayer();
let layerIds = [];
this._view.map.layers.forEach((layer) => {
layerIds.push(layer.id);
})
layerLegend.layerId = "layer1";
layerLegend.subLayerIds = layerIds;
legendLayers: [layerLegend],
*/
const template = new PrintTemplate({
format: 'pdf',
layout: 'a4-landscape',
layoutOptions: {
authorText: 'Blah',
titleText
},
});
const params = new PrintParameters({
view: this._view,
template,
});
//
// NOTE: Start the print progress spinner
//
this.printProgress = true;
const printURL = 'https://utility.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task';
PrintTask.execute(printURL, params).then((result) => {
//
// NOTE: Stop the spinner and open the print output
// into a new tab.
//
this.printProgress = false;
this.forceChange();
window.open(result.url);
}, () => {
this.alert.errorDialog('Print Error', 'Please try again or contact support!');
this.printProgress = false;
this.forceChange();
});
} Is there any reason for this behaviour? I'm I missing something in the PrintTemplate or PrintParameters? On a strange note, I don't use a valueExpression, I always get a legend on the print output: I suspect the problem has to do with the use of the valueExpression, so is there a way to pass my legend / layer information directly to the print task? Thanks
... View more
02-14-2023
02:21 PM
|
0
|
8
|
2315
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 04-25-2025 07:33 AM | |
| 1 | 03-18-2025 11:15 AM | |
| 1 | 10-07-2022 08:14 AM | |
| 1 | 08-25-2023 10:47 AM | |
| 1 | 02-23-2023 08:22 AM |
| Online Status |
Offline
|
| Date Last Visited |
10-24-2025
07:12 AM
|