#featurelayer
April 9, 2025 at 1:29 PM
Snapping does not work for WFSLayer in ArcGIS JavaScript API 3
I have a web application that I now need to use WFSLayer for some of the map layers. The problem is that snapping does not seem to work for WFS layers. The layer I use for drawing is a FeatureLayer. I need to be able to snap to features in other layers. I have this code: var snappingOptions = { tolerance: 20, alwaysSnap: true }; snappingOptions.layerInfos = []; var layerIds = map.graphicsLayerIds; layerIds.forEach(function (layerId) { var lyr = map.getLayer(layerId); if (lyr instanceof FeatureLayer || lyr instanceof WFSLayer) { var isLyrSnappable = true; if (snappableLayerUrls) { isLyrSnappable = snappableLayerUrls.some(function (layerUrl) { if (layerId.toLowerCase() === layerUrl.toLowerCase() || (lyr.url && lyr.url.toLowerCase() === layerUrl.toLowerCase())) { return true; } return false; }); } var layerInfo = { layer: lyr }; if (isLyrSnappable) { if (lyr.geometryType === "esriGeometryPolygon") { layerInfo.snapToEdge = false; layerInfo.snapToVertex = true; } else if (lyr.geometryType === "esriGeometryPolyline") { layerInfo.snapToVertex = true; } else if (lyr.geometryType === "esriGeometryPoint") { layerInfo.snapToPoint = true; } snappingOptions.layerInfos.push(layerInfo); } } }); console.log('snappingOptions', snappingOptions); map.enableSnapping(snappingOptions); When I look at the snapping options at the end, I se that my WFS layers are present in the snappingOptions.layerInfos array. When I activate a draw tool, the other FeatureLayer layers are snapped to, but not the WFSLayer layers. Is not snapping supported for the WFSLayer? How can I get around this?
gis.stackexchange.com
January 2, 2026 at 10:07 AM
ArcGIS geometryEngine.intersect always returns null
I am using the ArcGIS JavaScript API with the geometryEngine.intersect() method but I cannot get it to work on feature layers. In my code you can see how I can create and intersect 2 square geometries I created. But, in that same code, I also try to intersect one of the squares with every one of the 271 features in the featureLayer and the intersect() method returns null for every single one of them, even thought the map clearly shows some of them intercept the square. What am I doing wrong? My code is below an also in this codepen, is: ArcGIS JavaScript Tutorials: Buffer and intersect geometry html, body, #viewDiv { padding: 0; margin: 0; height: 100%; width: 100%; } require([ "esri/Map", "esri/views/MapView", "esri/layers/FeatureLayer", "esri/Graphic", "esri/geometry/geometryEngine", "esri/geometry/geometryEngineAsync" ], function(Map, MapView, FeatureLayer, Graphic, geometryEngine, geometryEngineAsync) { var map = new Map({ basemap: "topo-vector" }); var view = new MapView({ container: "viewDiv", map: map, center: [-118.80543,34.02700], zoom: 13 }); // Trails (lines) var featureLayer = new FeatureLayer({ url: "https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Trails_Styled/FeatureServer/0" }); map.add(featureLayer); let squareShape1 = { type: "polygon", rings: [ [-118.8, 34.05], [-118.8, 34], [-118.9, 34], [-118.9, 34.05] ], spatialReference: featureLayer.spatialReference }; let squareShape2 = { type: "polygon", rings: [ [-118.75, 34.08], [-118.75, 34.03], [-118.85, 34.03], [-118.85, 34.08] ], spatialReference: featureLayer.spatialReference }; let redOutline = { type: "simple-fill", color: [227, 139, 79, 0.1], outline: { color: [255, 0, 0], width: 1 } }; let blueOutline = { type: "simple-fill", color: [0, 79, 200, 0.1], outline: { color: [0, 0, 255], width: 1 } }; let squareA = new Graphic({ geometry: squareShape1, symbol: redOutline }); let squareB = new Graphic({ geometry: squareShape2, symbol: redOutline }); view.graphics.add(squareA); view.graphics.add(squareB); // intersect the 2 squares, this works geometryEngineAsync.intersect(squareA.geometry,squareB.geometry).then( function (result) { if (result) { console.log("Found an Intersection among the squares!"); console.log(result); let intersectionGraphic = new Graphic({ geometry: result, symbol: blueOutline }); view.graphics.add(intersectionGraphic); //show the intersection} } else { console.log("No Intersection"); }; }).catch(function (error) { console.log("Error"); console.log(error); }); //intersect.catch // Intersect the features in the featureLayer with one of the squares // DOES NOT WORK. instersect() always returns null, but is should not. // Queries for all the features in the featureLayer, so we can intersect each one featureLayer.queryFeatures().then(function (results) { console.log("Got results"); console.log(results); let layerGeometries = results.features.map(function (feature) { return feature.geometry; }); console.log("Num geometries=" + layerGeometries.length); layerGeometries.forEach(function (geometry) { // console.log("g="); // console.log(geometry); geometryEngineAsync.intersect(squareA.geometry,geometry).then( function (result) { if (result) { console.log("Found an Intersection!"); console.log(result); let intersectionGraphic = new Graphic({ geometry: result, symbol: blueOutline }); view.graphics.add(intersectionGraphic); //show the intersection} } else { console.log("No Intersection"); }; }).catch(function (error) { console.log("Error"); console.log(error); }); //catch }); //forEach console.log("Done forEach"); }); //queryFeatures.then console.log("Done queryFeatures"); }); When I run the code above I expect it to print out "Found and Intersection!" a few times, but it never prints that out. It prints "No Intersection" 271 times instead.
gis.stackexchange.com
January 3, 2026 at 8:06 AM
"AttributeError: 'FeatureLayer' object has no attribute 'overwrite'" error when overwriting feature service with CSV using ArcPy
I am trying to download a CSV from our project database and then append this to a feature service in AGOL. import os import requests import csv import arcpy from requests.auth import HTTPBasicAuth from arcgis.gis import GIS print('Environment variables loaded.') API_URL = 'https://web.lucion.co.uk/api/' API_ENDPOINT = 'jobs/get' USERNAME = 'removed' PASSWORD = 'removed' if USERNAME == 'my_email' or PASSWORD == 'my_password': raise Exception("You need to change your email and password") # Define the json post data json_data = { "filters": [ { "office.company": 11 } ], "limit": 1000, "expand": False, "columns": [ "id", "contract.id", "product_type", "title", "site.address", "site.lat", "site.lng" ] } # List to store all the rows from each page of data all_rows = [] # Make the first request and get the initial page of data print(f'Fetching data from API {API_ENDPOINT}...') response = requests.post(API_URL + API_ENDPOINT, json=json_data, auth=HTTPBasicAuth(USERNAME, PASSWORD)) while response.status_code == 200: data = response.json()['data'] print(f'Got {len(data["rows"])} rows.') # Add the rows from the current page to our total list of rows all_rows.extend(data['rows']) # If there's no 'next' key in the data, then there are no more pages if 'next' not in data or len(data['next']) == 0: break # If there's a 'next' key, then we need to get the next page of data # by including 'after' in our request with the value of 'next' json_data['after'] = data['next'] response = requests.post(API_URL + API_ENDPOINT, json=json_data, auth=HTTPBasicAuth(USERNAME, PASSWORD)) else: print(f'Request failed with status code: {response.status_code}') print (f'Got {len(all_rows)} rows in total.') csv_path = r"C:\NexGenExports\NexGenJobsExport.csv" absolutepath = os.path.abspath(csv_path) print(f'Writing data to CSV file at {absolutepath}...') with open(absolutepath, 'w', newline='', encoding='utf-8') as f: writer = csv.DictWriter(f, fieldnames=all_rows[0].keys()) writer.writeheader() writer.writerows(all_rows) print(f'Data successfully written to {absolutepath}.') # Your Arc Code: # ArcGIS Online credentials username = "removed" password = "removed" # Connect to ArcGIS Online gis = GIS("https://www.arcgis.com", username, password) # Get the feature service item feature_service_item = gis.content.get("635b6b9b19cb4c3e8bdd5b80cbbf8b16") # Get the feature layer from the item feature_layer = feature_service_item.layers[0] # Call the overwrite() method by passing the path to the CSV file feature_layer.overwrite(csv_path) # Clean up the downloaded CSV file os.remove(csv_path) print("CSV file downloaded and appended to the feature service successfully.") However, I get the following error AttributeError Traceback (most recent call last) In [21]: Line 90: feature_layer.overwrite(csv_path) AttributeError: 'FeatureLayer' object has no attribute 'overwrite' All of the code works until the bit where I wish to overwrite to ArcGIS Online. Does anyone know what might be the issue?
gis.stackexchange.com
September 13, 2026 at 3:12 AM
ArcGIS geometryEngine.intersect always returns null
I am using the ArcGIS JavaScript API with the geometryEngine.intersect() method but I cannot get it to work on feature layers. In my code you can see how I can create and intersect 2 square geometries I created. But, in that same code, I also try to intersect one of the squares with every one of the 271 features in the featureLayer and the intersect() method returns null for every single one of them, even thought the map clearly shows some of them intercept the square. What am I doing wrong? My code is below an also in this codepen, is: ArcGIS JavaScript Tutorials: Buffer and intersect geometry html, body, #viewDiv { padding: 0; margin: 0; height: 100%; width: 100%; } require([ "esri/Map", "esri/views/MapView", "esri/layers/FeatureLayer", "esri/Graphic", "esri/geometry/geometryEngine", "esri/geometry/geometryEngineAsync" ], function(Map, MapView, FeatureLayer, Graphic, geometryEngine, geometryEngineAsync) { var map = new Map({ basemap: "topo-vector" }); var view = new MapView({ container: "viewDiv", map: map, center: [-118.80543,34.02700], zoom: 13 }); // Trails (lines) var featureLayer = new FeatureLayer({ url: "https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Trails_Styled/FeatureServer/0" }); map.add(featureLayer); let squareShape1 = { type: "polygon", rings: [ [-118.8, 34.05], [-118.8, 34], [-118.9, 34], [-118.9, 34.05] ], spatialReference: featureLayer.spatialReference }; let squareShape2 = { type: "polygon", rings: [ [-118.75, 34.08], [-118.75, 34.03], [-118.85, 34.03], [-118.85, 34.08] ], spatialReference: featureLayer.spatialReference }; let redOutline = { type: "simple-fill", color: [227, 139, 79, 0.1], outline: { color: [255, 0, 0], width: 1 } }; let blueOutline = { type: "simple-fill", color: [0, 79, 200, 0.1], outline: { color: [0, 0, 255], width: 1 } }; let squareA = new Graphic({ geometry: squareShape1, symbol: redOutline }); let squareB = new Graphic({ geometry: squareShape2, symbol: redOutline }); view.graphics.add(squareA); view.graphics.add(squareB); // intersect the 2 squares, this works geometryEngineAsync.intersect(squareA.geometry,squareB.geometry).then( function (result) { if (result) { console.log("Found an Intersection among the squares!"); console.log(result); let intersectionGraphic = new Graphic({ geometry: result, symbol: blueOutline }); view.graphics.add(intersectionGraphic); //show the intersection} } else { console.log("No Intersection"); }; }).catch(function (error) { console.log("Error"); console.log(error); }); //intersect.catch // Intersect the features in the featureLayer with one of the squares // DOES NOT WORK. instersect() always returns null, but is should not. // Queries for all the features in the featureLayer, so we can intersect each one featureLayer.queryFeatures().then(function (results) { console.log("Got results"); console.log(results); let layerGeometries = results.features.map(function (feature) { return feature.geometry; }); console.log("Num geometries=" + layerGeometries.length); layerGeometries.forEach(function (geometry) { // console.log("g="); // console.log(geometry); geometryEngineAsync.intersect(squareA.geometry,geometry).then( function (result) { if (result) { console.log("Found an Intersection!"); console.log(result); let intersectionGraphic = new Graphic({ geometry: result, symbol: blueOutline }); view.graphics.add(intersectionGraphic); //show the intersection} } else { console.log("No Intersection"); }; }).catch(function (error) { console.log("Error"); console.log(error); }); //catch }); //forEach console.log("Done forEach"); }); //queryFeatures.then console.log("Done queryFeatures"); }); When I run the code above I expect it to print out "Found and Intersection!" a few times, but it never prints that out. It prints "No Intersection" 271 times instead.
gis.stackexchange.com
September 8, 2026 at 3:09 AM
Snapping does not work for WFSLayer in ArcGIS JavaScript API 3
I have a web application that I now need to use WFSLayer for some of the map layers. The problem is that snapping does not seem to work for WFS layers. The layer I use for drawing is a FeatureLayer. I need to be able to snap to features in other layers. I have this code: var snappingOptions = { tolerance: 20, alwaysSnap: true }; snappingOptions.layerInfos = []; var layerIds = map.graphicsLayerIds; layerIds.forEach(function (layerId) { var lyr = map.getLayer(layerId); if (lyr instanceof FeatureLayer || lyr instanceof WFSLayer) { var isLyrSnappable = true; if (snappableLayerUrls) { isLyrSnappable = snappableLayerUrls.some(function (layerUrl) { if (layerId.toLowerCase() === layerUrl.toLowerCase() || (lyr.url && lyr.url.toLowerCase() === layerUrl.toLowerCase())) { return true; } return false; }); } var layerInfo = { layer: lyr }; if (isLyrSnappable) { if (lyr.geometryType === "esriGeometryPolygon") { layerInfo.snapToEdge = false; layerInfo.snapToVertex = true; } else if (lyr.geometryType === "esriGeometryPolyline") { layerInfo.snapToVertex = true; } else if (lyr.geometryType === "esriGeometryPoint") { layerInfo.snapToPoint = true; } snappingOptions.layerInfos.push(layerInfo); } } }); console.log('snappingOptions', snappingOptions); map.enableSnapping(snappingOptions); When I look at the snapping options at the end, I se that my WFS layers are present in the snappingOptions.layerInfos array. When I activate a draw tool, the other FeatureLayer layers are snapped to, but not the WFSLayer layers. Is not snapping supported for the WFSLayer? How can I get around this?
gis.stackexchange.com
September 7, 2026 at 2:12 AM

Has anyone tried overriding core ArcGIS JS logic? I had to hack legend support for a custom layer extending FeatureLayer. The only way I found to make it appear in the Map legend was overriding Legend View Model validation: gist.github.com/JonnyDawe/db... #Arcgis #Arcgisdev #ArcGISMapsSDK
Hack - override LegendViewModel Validation.
Hack - override LegendViewModel Validation. GitHub Gist: instantly share code, notes, and snippets.
gist.github.com
December 11, 2024 at 11:37 AM
June 11, 2024 at 12:43 PM
For method return types, I chose to use concrete arrays, (e.g., FeatureLayer[]), to signify that these are closed, completed data sets.

/9
December 29, 2024 at 12:54 AM
This is all to map a single class or type, but most types in ArcGIS also have properties of other types. The dependency tree of just FeatureLayer is over 100 types, at least when you include interfaces and unions. And there are dozens of layer types, each with their own dependencies.

13/
December 13, 2024 at 4:00 PM
Selecting Polygon Feature using ArcGIS API for JavaScript?
I used ArcGIS JavaScript API 3.25 for developing. I want to select polygons within 1km radius. so I used a sample code that esri provides. But it works only for point features. I want to use that code for select polygons. Can you help me to correct my coding? var featureLayer = new FeatureLayer("http://203.189.68.219:6080/arcgis/rest/services/Sites/inginimitiya_Tank/MapServer/11" /* ,{ mode: FeatureLayer.MODE_ONDEMAND, infoTemplate: template, outFields: ["Name", "OBJECTID"] } */ ); var symbol = new SimpleLineSymbol( SimpleLineSymbol.STYLE_SOLID, 12, new SimpleLineSymbol( SimpleLineSymbol.STYLE_SOLID, new Color([247, 34, 101, 0.9]), 1 ), new Color([207, 34, 171, 0.5]) ); featureLayer.setSelectionSymbol(symbol); // Make unselected features invisible //var nullSymbol = new SimpleMarkerSymbol().setSize(0); //featureLayer.setRenderer(new SimpleRenderer(nullSymbol)); map.addLayer(featureLayer); var circleSymb = new SimpleFillSymbol( SimpleFillSymbol.STYLE_NULL, new SimpleLineSymbol( SimpleLineSymbol.STYLE_SHORTDASHDOTDOT, new Color([105, 105, 105]), 2 ), new Color([255, 255, 0, 0.25]) ); var circle; // When the map is clicked create a buffer around the click point of the specified distance map.on("click", function (evt) { circle = new Circle({ center: evt.mapPoint, geodesic: true, radius: 1, radiusUnit: "esriMiles" }); map.graphics.clear(); var graphic = new Graphic(circle, circleSymb); map.graphics.add(graphic); var query = new Query(); query.geometry = circle.getExtent(); // Use a fast bounding box query. It will only go to the server if bounding box is outside of the visible map. featureLayer.queryFeatures(query, selectInBuffer); }); function selectInBuffer(response) { var feature; var features = response.features; var inBuffer = []; // Filter out features that are not actually in buffer, since we got all points in the buffer's bounding box for (var i = 0; i < features.length; i++) { feature = features[i]; if (circle.contains(feature.geometry)) { inBuffer.push(feature.attributes[featureLayer.objectIdField]); } } var query = new Query(); query.objectIds = inBuffer; // Use an objectIds selection query (should not need to go to the server) featureLayer.selectFeatures(query, FeatureLayer.SELECTION_NEW, function (results) { var totalPopulation = sumPopulation(results); var r = ""; r = "The total Census Block population within the buffer is " + totalPopulation + "."; dom.byId("messages").innerHTML = r; }); }
gis.stackexchange.com
June 7, 2026 at 10:10 PM
applyEdits to FeatureLayer does not add geometry
I'm trying to add the feature into the layer with a geometry type polygon. When I call applyEdits it adds the feature attributes into the layer but not its geometry. Here is my dummy data object which is inserted into layer [{ "geometry": { "rings": [[[-16697923.619018555, 103676511.13576749], [-16697923.619018555, 103676511.13576749], [-16697923.619018555, 103676511.13576749], [-15584728.71105957, 103676511.13576749], [-16697923.619018555, 103676511.13576749]], [[-14582853.293945312, 103676511.13576749], [-15584728.71105957, 103676511.13576749], [-15362089.729492188, 103676511.13576749], [-14582853.293945312, 103676511.13576749]], [[-14248894.821533203, 103676511.13576749], [-14360214.31237793, 103676511.13576749], [-13247019.404418945, 103676511.13576749], [-14248894.821533203, 103676511.13576749]], [[-17922438.017700195, 103676511.13576749], [-17699799.036132812, 103676511.13576749], [-16697923.619018555, 103676511.13576749], [-17922438.017700195, 103676511.13576749]], [[-12245143.987304688, 103676511.13576749], [-13358338.895141602, 103676511.13576749], [-13024380.422851562, 103676511.13576749], [-12245143.987304688, 103676511.13576749]], [[-11911185.514892578, 103676511.13576749], [-12022505.005737305, 103676511.13576749], [-10909310.09777832, 103676511.13576749], [-11911185.514892578, 103676511.13576749]], [[-9907434.680664062, 103676511.13576749], [-11020629.588500977, 103676511.13576749], [-10686671.116210938, 103676511.13576749], [-9907434.680664062, 103676511.13576749]], [[-9796115.189819336, 103676511.13576749], [-9684795.69897461, 103676511.13576749], [-8607223.028198242, 103676511.13576749], [-8571600.791137695, 103676511.13576749], [-7569725.373901367, 103676511.13576749], [-8682920.281860352, 103676511.13576749], [-8610785.251831055, 103676511.13576749], [-9796115.189819336, 103676511.13576749]], [[-7347086.392333984, 103676511.13576749], [-7347086.392333984, 103676511.13576749], [-6233891.484375, 103676511.13576749], [-7347086.392333984, 103676511.13576749]], [[-5454655.048828125, 103676511.13576749], [-6233891.484375, 103676511.13576749], [-5120696.576538086, 103676511.13576749], [-5454655.048828125, 103676511.13576749]]], "spatialReference": { "wkid": 102100 } }, "attributes": { .. .. .. } }] Here is the code //Creating geometry from features collection var features = []; for (var i = 0; i < geojson.features.length; i++) { var geometry = geojson.features[i].geometry; if (geometry.type == "Polygon") { var feature = new Polygon(new SpatialReference({ wkid: 4326 })); var ring = [] for (var j = 0; j < geometry.rings.length; j++) { for (var k = 0; k < geometry.rings[j].length; k++) { var ringPoint = []; ringPoint.push(geometry.rings[j][k][0]); ringPoint.push(geometry.rings[j][k][1]); //rings.push(ring); ring.push(ringPoint); } } feature.addRing(ring); //polygon.addRing(ring); //geometries.push(polygon); features.push(feature); } } var polygon = geometryEngine.union(features); var geom = webMercatorUtils.geographicToWebMercator(polygon); //Creating add feature var editFeature = new Graphic({ geometry: geom, attributes: attributes }); lyr.applyEdits([editFeature], null, null, lang.hitch(this, function (results) { if (!results[0].success) { } }));
gis.stackexchange.com
June 2, 2026 at 10:05 AM
HitTest with MapImageLayer not returning sublayers
I'm new in ArcGIS, and what am I doing is viewing MapImageLayer with all of sublayers. But, when clicking on point and running hitTest it returns 0 results. Below the code: require([ "esri/config", "esri/Map", "esri/views/MapView", "esri/Graphic", "esri/widgets/Search", "esri/tasks/Locator", "esri/layers/GraphicsLayer", "esri/layers/FeatureLayer", "esri/identity/Credential", "esri/geometry", "esri/layers/MapImageLayer" ], function (esriConfig, Map, MapView, Graphic, Search, Locator, GraphicsLayer, FeatureLayer, Credential, Geometry, MapImageLayer) { var lat = 0; var lon = 0; var map = new Map({ }); //try to add layer const parksLayer = new MapImageLayer({ url: "", sublayers: [{ id: 0, visible: true, outFields:["*"] }] }); const topo = new MapImageLayer({ url: "https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" }); map.add(topo); map.add(parksLayer); var view = new MapView({ container: "viewDiv", map: map, center: [lon, lat], scale: 24000 }); view.on("click", function (evt) { debugger; console.log("latitude = " + evt.mapPoint.latitude); console.log("longitude = " + evt.mapPoint.longitude); // Create a graphic and add the geometry and symbol to it var graphic = new Graphic({ geometry: { type: "point", latitude: evt.mapPoint.latitude, longitude: evt.mapPoint.longitude, spatialReference: view.spatialReference, }, symbol: { type: "simple-marker", // autocasts as new SimpleFillSymbol color: [255, 10, 10], outline: { // autocasts as new SimpleLineSymbol() color: [255, 255, 255], width: 2, }, }, }); view.graphics.removeAll(); view.graphics.add(graphic); //trying to get layer info view.hitTest(evt).then(function (response) { debugger; console.log("layers count " + response?.results?.length); }); }); });
gis.stackexchange.com
May 22, 2026 at 6:09 PM
"AttributeError: 'FeatureLayer' object has no attribute 'overwrite'" error when overwriting feature service with CSV using ArcPy
I am trying to download a CSV from our project database and then append this to a feature service in AGOL. import os import requests import csv import arcpy from requests.auth import HTTPBasicAuth from arcgis.gis import GIS print('Environment variables loaded.') API_URL = 'https://web.lucion.co.uk/api/' API_ENDPOINT = 'jobs/get' USERNAME = 'removed' PASSWORD = 'removed' if USERNAME == 'my_email' or PASSWORD == 'my_password': raise Exception("You need to change your email and password") # Define the json post data json_data = { "filters": [ { "office.company": 11 } ], "limit": 1000, "expand": False, "columns": [ "id", "contract.id", "product_type", "title", "site.address", "site.lat", "site.lng" ] } # List to store all the rows from each page of data all_rows = [] # Make the first request and get the initial page of data print(f'Fetching data from API {API_ENDPOINT}...') response = requests.post(API_URL + API_ENDPOINT, json=json_data, auth=HTTPBasicAuth(USERNAME, PASSWORD)) while response.status_code == 200: data = response.json()['data'] print(f'Got {len(data["rows"])} rows.') # Add the rows from the current page to our total list of rows all_rows.extend(data['rows']) # If there's no 'next' key in the data, then there are no more pages if 'next' not in data or len(data['next']) == 0: break # If there's a 'next' key, then we need to get the next page of data # by including 'after' in our request with the value of 'next' json_data['after'] = data['next'] response = requests.post(API_URL + API_ENDPOINT, json=json_data, auth=HTTPBasicAuth(USERNAME, PASSWORD)) else: print(f'Request failed with status code: {response.status_code}') print (f'Got {len(all_rows)} rows in total.') csv_path = r"C:\NexGenExports\NexGenJobsExport.csv" absolutepath = os.path.abspath(csv_path) print(f'Writing data to CSV file at {absolutepath}...') with open(absolutepath, 'w', newline='', encoding='utf-8') as f: writer = csv.DictWriter(f, fieldnames=all_rows[0].keys()) writer.writeheader() writer.writerows(all_rows) print(f'Data successfully written to {absolutepath}.') # Your Arc Code: # ArcGIS Online credentials username = "removed" password = "removed" # Connect to ArcGIS Online gis = GIS("https://www.arcgis.com", username, password) # Get the feature service item feature_service_item = gis.content.get("635b6b9b19cb4c3e8bdd5b80cbbf8b16") # Get the feature layer from the item feature_layer = feature_service_item.layers[0] # Call the overwrite() method by passing the path to the CSV file feature_layer.overwrite(csv_path) # Clean up the downloaded CSV file os.remove(csv_path) print("CSV file downloaded and appended to the feature service successfully.") However, I get the following error AttributeError Traceback (most recent call last) In [21]: Line 90: feature_layer.overwrite(csv_path) AttributeError: 'FeatureLayer' object has no attribute 'overwrite' All of the code works until the bit where I wish to overwrite to ArcGIS Online. Does anyone know what might be the issue?
gis.stackexchange.com
May 14, 2026 at 10:05 PM