|
POST
|
Got it! Use a pointer-down, and pointer-up event, with a set flag: this._view.on("pointer-down", (event) => {
this._view.hitTest(event).then((response) => {
if (response.results.length && this._sketchWidget.activeTool === 'lasso-selection') {
this.lassoSet = true;
}
});
});
this._view.on("pointer-up", (event) => {
this._view.hitTest(event).then((response) => {
if (response.results.length && this.lassoSet) {
this.lassoSet = false;
console.log('Response from Lasso Selection');
console.log(response);
}
});
}); Now I have a list of selected assets, so I can query them 🙂 - Hope this helps someone! Thanks
... View more
08-25-2023
10:47 AM
|
1
|
0
|
1936
|
|
POST
|
Good Day I have a user who wants to do a reasonably complex selection using the Sketch Widget. Currently, I'm exposing the Draw Polygon, Rectangle and Circle functions, which react to the "create" event: this._sketchWidget.on("create", async (event) => {}) Which is fine, that works and I can select the map segment using those thee tools. The point selector responds to my "click" handler, which is also working properly, but what does the Lasso Tool throw for an event? It's not a click event, it's not the Sketch View create or update event, and according to the documentation, none of the other events would make any sense: https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch.html#events-summary Just so we're clear, this is the tool I'm talking about: Are there any examples to show this feature working? Thanks
... View more
08-25-2023
09:54 AM
|
0
|
4
|
1985
|
|
POST
|
Ya, experimentation lead me to the community forum! This is a pickle, I don't think there's a good way around this, since everything is generated client side. Luckily, there's another way to access these features and select them, but you can't do it on the map.
... View more
08-11-2023
12:22 PM
|
0
|
0
|
1644
|
|
POST
|
Good Day I know that you shouldn't query for things outside the DE, but assuming I want to select everything from the DE using the Sketch Widget selection tools, can I select things that aren't visible due to their size? This can happen if the feature becomes too small to render. Thanks
... View more
08-11-2023
07:03 AM
|
0
|
2
|
1653
|
|
POST
|
Good day If I have a view with 200 features in it, but only 150 features are shown because 50 of them are too small, after setting a definition expression, is there a method to select them all, even the non-visible ones, using the Sketch Widget "Draw a Rectangle" tool? My current logic is: Processng the "Draw" this._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);
}
}); Running the query: private selectFeatures(geometry): void {
const query = {
geometry: geometry,
outFields: ["*"],
returnGeometry: true,
};
this._view.graphics.removeAll();
this.sketchLayer.graphics.removeAll();
this._view.map.layers.forEach((layer) => {
if (layer.type === 'feature') {
this._view.whenLayerView(layer).then((layerView) => {
layerView.queryFeatures(query).then((results: IQueryFeaturesResponse) => {
this.blah = [];
results.features.forEach((result) => {
this.blah.push(result.attributes.objectId);
const graphic = new Graphic(<GraphicProperties>result.geometry);
this._view.graphics.add(graphic);
})
}).catch((queryError) => {
console.log('Query Error');
console.log(queryError);
})
})
}
})
} Is there a query parameter I can use to make sure everything, no matter its size, is selected? Thanks
... View more
08-10-2023
10:27 AM
|
0
|
4
|
1731
|
|
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
|
2980
|
|
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
|
1667
|
|
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
|
571
|
|
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
|
3916
|
|
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
|
3954
|
|
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
|
5718
|
|
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
|
889
|
|
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
|
1184
|
| 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 |
03-13-2026
07:55 AM
|