|
POST
|
It looks like this may be the same issue resolved in this thread: https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/adding-a-row-to-a-table-using-js-4-x/m-p/1601382/highlight/true#M86790 Is that true, or is this a different one?
... View more
04-08-2025
10:17 AM
|
1
|
1
|
990
|
|
POST
|
Aloha Noah, thanks for following up. Your example uses the Shape_Length field, so doesn't exhibit the problem, since that's a numerical attribute. The problem I'm running into appears to happen when using the Geometry function. In your example, I changed the expression to: expression: "Round(Length(Geometry($feature),\"feet\"),2)" In doing so, I was surprised to find it working. I then changed line 22 to use version 4.31, and the labels stopped appearing, although there weren't any errors in the console. It appears that perhaps this may have been fixed in 4.32. I haven't started testing with 4.32 yet, but plan to later this week or next. When I do, I'll try this issue out and see what happens.
... View more
04-08-2025
09:45 AM
|
1
|
0
|
1148
|
|
POST
|
It looks like "roomEditData" is an array of objectIDs. In that case, you'd want something like this instead of what you presently have on lines 4-10: const updates = [];
roomEditData.forEach(function(oid) {
updates.push ({
attributes: {
OBJECTID: oid,
PHYSICALCAPACITY: document.getElementById ('editroomDetails-PHYSICALCAPACITY').value
}
});
}); That assumes that the OID field name for the layer is actually "OBJECTID". If it isn't, you'll need to change the field name on line 5.
... View more
04-07-2025
05:10 PM
|
2
|
1
|
4953
|
|
POST
|
I have a map service published to ArcGIS Server whose spatial reference is WGS 84 UTM Zone 6N (WKID 32606). One of the layers in the service has labeling information defined, and the labelExpressionInfo.expression is set to: Round(Length(Geometry($feature),"feet"),2). I load this layer into a map as a 2D FeatureLayer. The spatial reference of the map is Web Mercator (WKID 3857). The data being retrieved from the server is returned by ArcGIS Server projected into Web Mercator (WKID 3857). Nonetheless, labels do not show up, and the following error appears in the console: Cannot work with geometry in this spatial reference. It is different to the execution spatial reference. This should not be happening because the data queried from the service is already in the Web Mercator projection. The problem is that the API, when processing the FeatureSets returned from the server, assigns the layer's spatial reference (WKID 32606) to the data, even though the coordinates are Web Mercator. The most convenient place I've found to insert a fix for this is in the esri.views.2d.layers.features.support.FeatureSetReaderJSON module, in the "fromFeatureSet" method. The published implementation looks like this: static fromFeatureSet(a, f) {
a = q.convertFromFeatureSet(a, f.objectIdField);
return l.fromOptimizedFeatureSet(a, f)
} The "a" parameter is the FeatureSet returned from the query, still in JSON format. The "f" parameter is an object containing various settings from the layer, including the spatial reference. Basically, I clone the "f" object, and set its spatial reference to the same as the FeatureSet: static fromFeatureSet(a, f) {
var g = {};
Object.getOwnPropertyNames(f).concat(Object.getOwnPropertyNames(Object.getPrototypeOf(f))).forEach(function(h) {
if (typeof f[h] != "function")
g[h] = f[h];
});
if (a.spatialReference)
g.spatialReference = f.spatialReference.constructor.fromJSON(a.spatialReference);
f = g;
a = q.convertFromFeatureSet(a, f.objectIdField);
return l.fromOptimizedFeatureSet(a, f)
} As can be seen, I've added lines 2-9, and everything else is the same. With this fix in place, no errors occur and the labels show up properly. I was using 4.31 for this, but other versions may be affected as well.
... View more
04-07-2025
04:51 PM
|
0
|
3
|
1207
|
|
POST
|
Have you considered extending the Accessor class? See also https://developers.arcgis.com/javascript/latest/implementing-accessor/
... View more
03-25-2025
07:21 PM
|
2
|
3
|
1817
|
|
POST
|
Yes, you can create a legend as a child of any pre-existing element. The following example shows getting a reference to an existing element via document.getElementById: const legend = new Legend({
view: view,
container: document.getElementById("sidebar")
}); In your example, the "sidebar" element needs to be created and added to the document before creating the Legend though.
... View more
03-25-2025
06:31 PM
|
2
|
1
|
1077
|
|
POST
|
Ok, since there's no payload tab, I see what you were saying earlier about the tab going away. Unfortunately, without it, it doesn't give us much to go on. It makes me wonder if the request is being sent without the features being edited because if I understand it correctly, the Payload tab should still be there even if a POST request results in an HTTP 500. This one may need Esri Technical Support if you have access to it.
... View more
03-13-2025
01:44 PM
|
0
|
1
|
2185
|
|
POST
|
That shows the request for the query option that preceded applyEdits, but I would need to see the details for the applyEdits request. That is, you'd need to double click the row for applyEdits.
... View more
03-13-2025
01:14 PM
|
0
|
3
|
2188
|
|
POST
|
Maybe if you can post a screenshot of the payload tab for a request that works (single) and a request that fails (multiple) it might help reveal if the problem is on the application side.
... View more
03-13-2025
11:50 AM
|
0
|
5
|
2191
|
|
POST
|
If you double-click on a request in the Network log, you'll see an additional set of tabs with information about the request...the Payload tab is in there.
... View more
03-12-2025
11:45 AM
|
0
|
10
|
2197
|
|
POST
|
That looks fine as far as I can tell. You might want to check out the Network Tab of the developer tools and look into the details of the request sent to applyEdits. Particularly, check out the payload to make sure everything looks proper in there.
... View more
03-11-2025
04:21 PM
|
0
|
1
|
2281
|
|
POST
|
A few things to check: 1) Make sure this data is going to the right layer in the service. 2) Make sure all the fields are named correctly and exist in the service. Field names are case sensitive. 3) The OBJECTID field shouldn't be included in the attributes you capture from the form. Lines 9 and 10 in the code I wrote are supposed to strip it out if it's present. I suppose the server could generate an error if multiple update records were supplied with the same objectID values. For reference, since it's on a different page now, here's the code where you capture the values from the form: editRoom.OBJECTID = Number (roomObjectID)
editRoom.ADA = document.getElementById ('roomDetails-ADA').value;
editRoom.CAPACITY = document.getElementById ('roomDetails-CAPACITY').value;
editRoom.SPACETYPECAT1KEY = document.getElementById ('roomDetails-SPACETYPECAT1KEY').value;
editRoom.SPACETYPECAT2KEY = document.getElementById ('roomDetails-SPACETYPECAT2KEY').value;
editRoom.SPACEUSECAT1KEY = document.getElementById ('roomDetails-SPACEUSECAT1KEY').value;
editRoom.SPACEUSECAT2KEY = document.getElementById ('roomDetails-SPACEUSECAT2KEY').value;
editRoom.DESCRIPTION = document.getElementById ('roomDetails-DESCRIPTION').value;
editRoom.CAPACITY = document.getElementById ('roomDetails-CAPACITY').value;
editRoom.ASSIGNABLE = document.getElementById ('roomDetails-ASSIGNABLE').value;
editRoom.NOTES = document.getElementById ('roomDetails-NOTES').value;
editRoom.USABLE = document.getElementById ('roomDetails-USABLE').value;
... View more
03-07-2025
05:31 PM
|
0
|
3
|
2301
|
|
POST
|
Are you able to log into ArcGIS Server Manager for that instance? If so, the logs may contain more information.
... View more
03-07-2025
12:32 PM
|
0
|
6
|
2340
|
|
POST
|
My bad, line 16 above should be: featureLayer.applyEdits({updateFeatures:featureSet.features}).then( I'll change it in that post too.
... View more
03-07-2025
12:08 PM
|
0
|
8
|
2345
|
|
POST
|
If you want to set multiple features to have the same attribute values, you could do so with a function like this: function _applyUpdates (featureLayer, attributes, objectIds)
{
return new Promise(function(resolve, reject) {
var query = featureLayer.createQuery();
query.returnGeometry = true;
query.objectIds = objectIds;
featureLayer.queryFeatures().then(function(featureSet) {
if (attributes.hasOwnProperty(featureLayer.objectIdField))
delete attributes[featureLayer.objectIdField];
featureSet.features.forEach(function(feature) {
Object.assign(feature.attributes, attributes);
});
featureLayer.applyEdits({updateFeatures:featureSet.features}).then(
function (results)
{
console.log (results);
resolve();
}, // callback
function (error)
{
console.log ('ERROR!', error);
reject(error);
}// errorback
);
});
});
} You would then determine the records you want to update, and create an Array of their objectID values: var objectIds = [1,2,3,4,5]; Then you could call the function: _applyUpdates(roomsTable, editRoom, objectIds);
... View more
03-07-2025
09:56 AM
|
0
|
10
|
2359
|
| 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 |