|
IDEA
|
The Editor widget is very capable in editing feature data. It needs to be enhanced to be able to: Edit table only data and especially related table data. Show a calendar view for selecting a date entry (currently an enhancement request somewhere). Have the ability to access the currently selected layer as an object property as well as the data updated event so that one could attach a function to perform various calculations on the layer after data gets edited. Have many CSS theme possibilities
... View more
02-16-2022
08:04 AM
|
1
|
1
|
980
|
|
POST
|
Yeah, just remember it was all built with Javascript so eventually you should be able to figure out how to do something similar. Just classes, functions, methods, and events. Always nice to have someone of Rene's caliber to chime in when your a little off but bet you would have been able to get close to what I did. Now you can also include a next by not popping the extent off and losing it after each previous. Not sure what that will be but make sure to post it once you get it finished.
... View more
02-14-2022
11:27 AM
|
1
|
0
|
4676
|
|
POST
|
I don't know if there will ever be the same functions as in 3.X, but I implemented the same (at least the previous extents) using a little code. // Add a variable somewhere before it all happens
let prevPoint = [];
// You probably already have a 'view.when' section, add the 'view.watch' to
// look for changes to the extent and store those in the prevPoint list.
view.when(function () {
// Setup listener for the extent change, then populate the previous point using its center
view.watch("extent", function (newValue, oldValue) {
let dTest = Math.abs(newValue.xmax - newValue.xmin);
let dFactor = dTest / 100; // Need to leave any small movements behind, but these depend on scale.
if (Math.abs(newValue.xmax - oldValue.xmax) > dFactor ||
Math.abs(newValue.xmin - oldValue.xmin) > dFactor ||
Math.abs(newValue.ymax - oldValue.ymax) > dFactor ||
Math.abs(newValue.ymin - oldValue.ymin) > dFactor) {
prevPoint.push(newValue);
}
if (prevPoint.length > 40) { prevPoint.shift(); //stored }
});
});
// Previous button functionality (zoom to previous)
let btnPrevExtent = dom.byId("btnPrevExtent");
on(btnPrevExtent, "click", function () {
zoomPrevious();
})
function zoomPrevious() {
if (prevPoint.length > 1) {
prevPoint.pop();
let lastEx = prevPoint[prevPoint.length - 1];
prevPoint.pop();
view.extent = lastEx;
}
} Could probably be made more concise but you get the idea.
... View more
02-14-2022
10:11 AM
|
2
|
2
|
4692
|
|
POST
|
I don't think the Javascript API has a 'curve' object, or capacity to draw one through a widget, but maybe you can draw one using Javascript and then use it as feature geometry. Here are 2 concept pages I found: https://gis.stackexchange.com/questions/153265/using-cubiccurve-in-openlayers-2 Bezier curve (javascript.info) Ooh, and this GitHub library looks like it has potential: https://github.com/crazyxhz/ArcGIS-JavaScript-API-4.2-3D-Draw-Extension And be safe out there by always copying links into Notepad first. There are now web sites that use Javascript to change the link you thought you had with a malicious one.
... View more
01-27-2022
03:53 PM
|
0
|
0
|
1494
|
|
POST
|
I don't know anything about React, but my first thought was that I've never heard of ESRI_OID being used as the internal ID, it's always been OBJECTID from what I've seen. Since the REST service is in ArcGIS Online you can go there to check on the exact field names. Also, if you are confident with the 'ESRII_OID' fieldname, you should probably put those in lists like [ESRI_OID]. If all else fails, remark out the order by and put ['*'] in the outFields.
... View more
01-27-2022
03:43 PM
|
0
|
1
|
2243
|
|
POST
|
Visibility is separate from the Definition Expression thing. My point is that you don't need to rely on definition expression to control the layer's visibility. If you 'load' the layer at the beginning with it turned off, you aren't worrying about it being visible with any defined expression, but when you the user generates an expression you can turn visibility on to display the results. Maybe this example will help: <!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="viewport"
content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<title>
Example resetting a FeatureLayer's Definition Expression with Visibility
</title>
<link rel="stylesheet"
href="https://js.arcgis.com/4.22/esri/themes/dark/main.css" />
<script src="https://js.arcgis.com/4.22/"></script>
<style>
html,
body,
#viewDiv {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
#infoDiv {
padding: 6px;
width: 370px;
height: 97%;
position: absolute;
top: 10px;
right: 10px;
--calcite-ui-brand: #71C96E;
--calcite-ui-brand-hover: #67B564;
}
#resultsDiv {
overflow: auto;
display: none;
}
</style>
<script>
require([
"esri/Map",
"esri/views/MapView",
"esri/layers/FeatureLayer",
"esri/Basemap",
"esri/layers/GeoJSONLayer"
], (
Map,
MapView,
FeatureLayer,
Basemap,
GeoJSONLayer
) =>
(async () => {
// dark human geography basemap
const basemap = new Basemap({
portalItem: {
id: "4f2e99ba65e34bb8af49733d9778fb8e"
}
});
// layers
const layer1 = new FeatureLayer({
url: "https://services9.arcgis.com/RHVPKKiFTONKtxq3/ArcGIS/rest/services/NDFD_WindForecast_v1/FeatureServer/0",
outFields: ["*"]
});
const geojsonLayer = new GeoJSONLayer({
url: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.geojson",
copyright: "USGS Earthquakes",
visible: false
});
const map = new Map({
basemap,
layers: [layer1, geojsonLayer]
});
const view = new MapView({
container: "viewDiv",
map: map,
center: [-112.4, 33.5],
zoom: 3,
padding: {
right: 380
}
});
view.when(function () {
view.ui.add("buttons", "bottom-right");
document.getElementById("btnTest1").addEventListener('click', function () { testDef("Low"); });
document.getElementById("btnTest2").addEventListener('click', function () { testDef("High") });
document.getElementById("btnOff").addEventListener('click', function () { testDef("Off") });
});
function testDef(inCheck) {
if (inCheck == "Off") {
geojsonLayer.visible = false;
}
else {
geojsonLayer.visible = true;
var defExp = "mag < 1";
if (inCheck == "High") {
defExp = "mag > 1";
}
geojsonLayer.definitionExpression = defExp;
}
}
})());
</script>
</head>
<body>
<div id="viewDiv"></div>
<div id="buttons">
<button id="btnTest1">Low Magnitude</button>
<button id="btnTest2">High Magnitude</button>
<button id="btnOff">Off</button>
</div>
</body>
</html>
... View more
01-19-2022
12:43 PM
|
0
|
0
|
1262
|
|
POST
|
Can you just set it's visible property to 'false' when you create it, and then load it into the View as normal? Then you can set it's visible property to 'true' when the user clicks on something.
... View more
01-19-2022
11:48 AM
|
1
|
0
|
1284
|
|
POST
|
This works for me in both 4.21 and 4.22. Not sure of your particular feature service URL, but this one using stream data on top of an Esri simple example will correctly apply the definition expression, and then remove it based on the button chosen. If you are still experiencing issues, maybe adding some actual code would help decipher it. <!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="viewport"
content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<title>
Example resetting a FeatureLayer's Definition Expression
</title>
<link rel="stylesheet"
href="https://js.arcgis.com/4.22/esri/themes/dark/main.css" />
<script src="https://js.arcgis.com/4.22/"></script>
<style>
html,
body,
#viewDiv {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
#infoDiv {
padding: 6px;
width: 370px;
height: 97%;
position: absolute;
top: 10px;
right: 10px;
--calcite-ui-brand: #71C96E;
--calcite-ui-brand-hover: #67B564;
}
#resultsDiv {
overflow: auto;
display: none;
}
</style>
<script>
require([
"esri/Map",
"esri/views/MapView",
"esri/layers/FeatureLayer",
"esri/Basemap"
], (
Map,
MapView,
FeatureLayer,
Basemap
) =>
(async () => {
// dark human geography basemap
const basemap = new Basemap({
portalItem: {
id: "4f2e99ba65e34bb8af49733d9778fb8e"
}
});
// national parks layer
const layer = new FeatureLayer({
url: "https://services9.arcgis.com/RHVPKKiFTONKtxq3/arcgis/rest/services/Live_Stream_Gauges_v1/FeatureServer/0",
outFields: ["*"]
});
const map = new Map({
basemap,
layers: [layer]
});
const view = new MapView({
container: "viewDiv",
map: map,
center: [-112.4, 33.5],
zoom: 9,
padding: {
right: 380
}
});
const layerView = await view.whenLayerView(layer);
view.when(function () {
view.ui.add("buttons", "bottom-right");
document.getElementById("btnTest1").addEventListener('click', function () { testDef("All"); });
document.getElementById("btnTest2").addEventListener('click', function () { testDef("Flowing") });
});
function testDef(inTest) {
var defExp = "";
if (inTest == "Flowing") {
defExp = "stage_ft > 0.3 and org = 'Maricopa County'";
}
layer.definitionExpression = defExp;
layer.refresh();
}
})());
</script>
</head>
<body>
<div id="viewDiv"></div>
<div id="buttons">
<button id="btnTest1">All</button>
<button id="btnTest2">Flowing</button>
</div>
</body>
</html>
... View more
01-18-2022
10:03 AM
|
0
|
0
|
3299
|
|
POST
|
Just messing around with the Esri Editor widget sample (Editor sample code ), I added this and could get some size changes. Somewhere in the CSS is your desired goal. <style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
.esri-editor .esri-item-list__scroller {
max-height: 450px;
}
.esri-view-height-small .esri-expand .esri-widget--panel, .esri-view-height-small .esri-expand .esri-widget--panel-height-only, .esri-view-height-small .esri-ui-corner .esri-component.esri-widget--panel, .esri-view-height-small .esri-ui-corner .esri-component.esri-widget--panel-height-only {
max-height: 620px;
min-height: 500px;
}
.esri-ui .esri-editor .esri-item-list__scroller {
max-height: 390px;
}
</style>
... View more
01-18-2022
06:49 AM
|
1
|
0
|
2190
|
|
POST
|
Your layer needs to be triggered to refresh I think, and I believe csvLayer.refresh() will force it to do just that.
... View more
01-18-2022
06:32 AM
|
0
|
0
|
1182
|
|
POST
|
You could try to use "esri/request" for the changes. I don't think it updates the map automatically after an update. Below is a class that I've used that separates out the deletes, adds, and updates. I wanted to perform any deletes first and make sure they were done before I did any adds or updates, that's why I'm using Promises in it, but you could send a JSON string will of your adds, deletes, and updates at the same time. The JSON was created before calling this class. require([
"esri/Map",
"esri/request"
], function (Map, esriRequest) {
...
function modifyRecords(jsonAdds, jsonUpdates, jsonDeletes, urlIn, sTable, deferred) {
try {
let urlDelete = urlIn + "/deleteFeatures";
let urlAddUp = urlIn + "/applyEdits";
// If deletes exist, perform them first
let defDeletes = new Deferred();
if (jsonDeletes.length > 0) {
var postOptDelete = {};
postOptDelete["method"] = "post";
postOptDelete["responseType"] = "json";
postOptDelete["query"] = { f: "json", objectIds: jsonDeletes };
esriRequest(urlDelete, postOptDelete
).then(function (results) {
if (results.data && results.data.deleteResults && results.data.deleteResults.length > 0) {
console.log("Delete Results: ", results.data.deleteResults);
}
else {
console.log("No deletes processed for " + sTable);
}
defDeletes.resolve(results);
})
.catch(function (error) {
console.error("ModifyRecords - Deletes: " + error);
defDeletes.reject(error);
})
}
else {
defDeletes.resolve("Empty");
console.log("No deletes processed for " + sTable);
}
all(defDeletes).then(function (results) {
let defAdds = new Deferred();
if (jsonAdds.length > 0) {
var postOptAdd = {};
postOptAdd["method"] = "post";
postOptAdd["responseType"] = "json";
postOptAdd["query"] = { f: "json", "adds": JSON.stringify(jsonAdds), "updates": "", "deletes": "" };
esriRequest(urlAddUp, postOptAdd
).then(function (results) {
if (results.data && results.data.addResults && results.data.addResults.length > 0) {
console.log("Add Results: ", results.data.addResults);
}
else {
console.log("No additions processed for " + sTable);
}
defAdds.resolve(results);
})
.catch(function (error) {
console.error("ModifyRecords - Adds: " + error);
defAdds.reject(error);
})
}
else {
defAdds.resolve("Empty");
console.log("No additions processed for " + sTable);
}
all(defAdds).then(function (results) {
if (jsonUpdates.length > 0) {
var postOptUpdate = {};
postOptUpdate["method"] = "post";
postOptUpdate["responseType"] = "json";
postOptUpdate["query"] = { f: "json", "adds": "", "updates": JSON.stringify(jsonUpdates), "deletes": "" };
esriRequest(urlAddUp, postOptUpdate
).then(function (results) {
console.log(results);
if (results.data && results.data.updateResults && results.data.updateResults.length > 0) {
console.log("Update Results: ", results.data.updateResults); var objectIds = [];
}
else {
console.log("No updates processed for " + sTable);
}
})
.catch(function (error) {
console.error("ModifyRecords - Adds: " + error);
defAdds.reject(error);
})
}
else {
console.log("No updates processed for " + sTable);
}
deferred.resolve(results);
return deferred.promise
})
})
}
catch (e) {
console.log(e.message);
deferred.reject(e.message);
return deferred.promise;
}
}
... View more
11-29-2021
08:37 AM
|
0
|
1
|
1376
|
|
POST
|
Sorry, I've tried to get a workaround but this should be working. In the error is the message "Instance of 'esri.layers.GraphicsLayer' is already destroyed", but I can't figure out why that would be happening. I'm thinking you should open a ticket with Esri on this one as it looks like a bug to me.
... View more
11-29-2021
08:03 AM
|
1
|
0
|
2185
|
|
POST
|
This ArcGIS Online help page says that you can search for data by using the 'Location filter': https://doc.arcgis.com/en/arcgis-online/reference/search.htm And when you select 'Add', 'Search for layers' there is an option under Filter to 'Only show content within map area' but there is no filtering to that. I get way too many hits with the majority having no relation to the current zoom extents. This seems like it was working before.
... View more
11-24-2021
07:51 AM
|
0
|
0
|
547
|
|
POST
|
When I setup my Editor at 4.20, I'm using the 'stringFieldOption' attribute to set the field type to "text-area", which I think predetermines the editor to adjust to it. editor = new Editor({
view: view,
allowedWorkflows: ["update"], // allows only updates and no adds
layerInfos: [{
layer: busStopLayer,
fieldConfig: [
{
label: "Location",
initialState: "collapsed",
description: "General location information",
fieldConfig: [
{ name: "Location", label: "Location" },
{ name: "Owner", label: "Owner" }
]
},
{
label: "Structure",
initialState: "collapsed",
description: "Information about the bus stop",
fieldConfig: [
{ name: "StopType", label: "Type of Stop" },
{ name: "Condition", label: "Condition Assesment" },
{ name: "ConditionDate", label: "Date of Condition Assessment", formatter: formatTimestamp },
{ name: "Comments", label: "Add any general comments", stringFieldOption: "text-area" }
]
},
enabled: true
}],
container: "editDiv",
});
view.ui.add("editDiv", { position: "top-right", index: 2 });
... View more
11-22-2021
10:00 AM
|
1
|
0
|
1868
|
|
POST
|
Not sure why you need to open the same page more than 25 times, but I opened your first link and it didn't do the same thing to me (MS Edge Version 95.0.1020.44 (Official build) (64-bit) or Chrome Version 95.0.4638.69 (Official Build) (64-bit)). In fact, this page is like the 34th or something. Maybe it's in your system setup or something.
... View more
11-10-2021
07:25 AM
|
0
|
0
|
5755
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 11-01-2022 02:02 PM | |
| 1 | 02-28-2024 01:40 PM | |
| 2 | 02-27-2024 01:13 PM | |
| 1 | 10-18-2022 11:31 AM | |
| 1 | 06-23-2023 09:13 AM |
| Online Status |
Offline
|
| Date Last Visited |
05-28-2025
09:15 AM
|