|
POST
|
Is your requirement that calculations only fire when features are added via web or are you saying you want calculations to happen with all clients? I think if you don't care where the edits are being made the path of least resistance is to schedule a script to run every minute (or few minutes) between collection hours. You could set up the logic such that it doesn't recalculate everything, just what has actually changed. I have experience doing this in the past with great success. Field crews and management had up-to-date information when needed (only had to refresh map).
... View more
09-19-2023
06:30 AM
|
0
|
1
|
1107
|
|
POST
|
You might consider other options. EPQS (nationalmap.gov) comes to mind. If you are working with Image Services, then you might be able to use one of those endpoints. I think Identify and Get Samples could work for this use case.
... View more
09-15-2023
12:28 PM
|
1
|
1
|
5355
|
|
POST
|
Those are system-generated fields and there's generally no reason to mess with them. What makes you say those fields are preventing you from creating new geometry?
... View more
09-14-2023
10:20 AM
|
0
|
1
|
1508
|
|
POST
|
Okay, so all you have to do is pop open your Field Calculator, write a simple function, and apply to your target date field like so: With your sample values, I get:
... View more
09-14-2023
09:17 AM
|
1
|
0
|
1958
|
|
POST
|
What's the input/value that changes across the records? Is it the date (1980, 1, 6)?
... View more
09-14-2023
06:09 AM
|
0
|
3
|
1982
|
|
POST
|
Hey, Seems like your next step is to figure out which field(s) is causing the 1000: String or binary data would be truncated error. From there, you can either truncate the string yourself or increase the length of the string field. One way to figure out which fields are causing the issue is to create a dataframe from your input records, get the max length of all string columns, and compare that length to the field length: # where 'df' is created from your input records
string_fields = [field for field in fl.properties.fields if field.type == "esriFieldTypeString"]
for field in string_fields:
max_string_length = df[field.name].apply(lambda x: len(x)).max()
if max_string_length > field.length:
print(f"{field.alias}: length needs to meet or exceed {max_string_length}")
... View more
09-13-2023
06:48 AM
|
1
|
0
|
2000
|
|
POST
|
I don't use ArcGIS Notebooks much these days, so my assumption is there's some problem you're running into writing the zips to disk. I think you may be able to accomplish this in memory using a BytesIO object. I don't have immediate access to an FTP so I'm going to approximate this workflow using a web request, but the logic is pretty much the same. Here is a working example of how to do the initial publish: import requests
import io
from arcgis import GIS
zip_url = "https://www2.census.gov/geo/tiger/GENZ2018/shp/cb_2018_us_cd116_20m.zip"
r = requests.get(zip_url)
f = io.BytesIO()
f.write(r.content)
gis = GIS("https://arcgis.com/", "username", "pass")
item_properties = {
"type": "Shapefile",
"title": "test",
"fileName": "virtual_zip.zip"
}
shpfile = gis.content.add(item_properties, f)
published_service = shpfile.publish() You can overwrite like this: import requests
import io
from arcgis import GIS
from arcgis.features import FeatureLayerCollection
zip_url = "https://www2.census.gov/geo/tiger/GENZ2018/shp/cb_2018_us_cd116_20m.zip"
r = requests.get(zip_url)
f = io.BytesIO()
f.write(r.content)
gis = GIS("https://arcgis.com/", "username", "pass")
item_id = "d44e3b2892a54f25a11def293724acbc"
item = gis.content.get(item_id)
flc = FeatureLayerCollection.fromitem(item)
flc.manager.overwrite(f) In your case, I think the for loop would change to something like this: f = io.BytesIO()
ftp.retrbinary("RETR "+ zipfile, f.write)
f.seek(0)
... View more
09-13-2023
06:24 AM
|
0
|
0
|
3017
|
|
POST
|
Take a look at example 2 here: MapSeries—ArcGIS Pro | Documentation. It's quite similar (I think) to what you're hoping to do.
... View more
09-12-2023
02:47 PM
|
0
|
0
|
2641
|
|
POST
|
The MapSeries itself has no exportToJPEG method is what's going on. What you're supposed to do is set the map series current page (as you are doing) and then export from the Layout object. I believe that means your last line should be: lyt.exportToJPEG(finallocationwithPIN)
... View more
09-12-2023
02:41 PM
|
1
|
4
|
2650
|
|
POST
|
Hello. What you are looking for is edit_features. This allows you to do adds, updates, and deletes. You can get a sense of how to use this method here: Editing Features | ArcGIS API for Python
... View more
09-07-2023
05:55 PM
|
1
|
0
|
2602
|
|
POST
|
That parameter is optional, so I think either not supplying it or setting the value to "*" should do what you want. You may have to page through results, however.
... View more
09-04-2023
10:04 AM
|
0
|
0
|
1253
|
|
POST
|
I am seeing this too. Looks like the SHAPE_LENGTH field does not come through with GDB feature classes, at least. The good news, however, is it's simple to re-calculate the Shape length field: sedf["length"] = sedf["SHAPE"].apply(lambda x: x.get_length("PLANAR", "METERS")) More information on get_length options here.
... View more
09-01-2023
06:52 AM
|
0
|
0
|
1887
|
|
POST
|
I've seen this before - the error handling is not always the best. What I have done in the past to troubleshoot is run small batches through edit_features until I can find the culprit(s). I can't recall the specifics of what was wrong each time, but I'm pretty sure at least once it was that a float was being applied to an int field. I think other times they were strings that exceeded the max length. You say you're updating geometry - I don't believe I've encountered an issue with that yet, but if the update includes non-geometry fields then perhaps you can check the below: For the first scenario, you may need to check your dtypes to ensure that they're compatible. For the second scenario (which happened a lot more frequently), I used to have a helper function that found the max string length in a dataframe column and compared that to the field length of the Feature Layer field. If it exceeded the field length, then I would update the feature layer definition to increase the field length. If this isn't an option, you might be able to pare down the string causing the issue.
... View more
08-23-2023
05:41 PM
|
1
|
0
|
1573
|
|
POST
|
Hi, I think for the if statement you should change to something like if x.properties.geometryType == "esriGeometryPoint": You could also approach this differently if this is the only thing you need to do. Here's a working snippet that uses just the ArcGIS API for Python: from arcgis import GIS
from arcgis.features import FeatureLayer
gis = GIS()
sample_url = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Earthquakes_Since1970/FeatureServer/0"
fl = FeatureLayer(sample_url, gis)
sdf = fl.query(as_df=True)
if fl.properties.geometryType == "esriGeometryPoint":
sdf["x"] = sdf.SHAPE.apply(lambda x: x.x)
sdf["y"] = sdf.SHAPE.apply(lambda x: x.y)
sdf.spatial.to_featureclass(location=r"c:\temp\eq.shp")
... View more
08-16-2023
02:35 PM
|
0
|
0
|
1638
|
|
BLOG
|
@David_Brooks I've not tried it with Imagery Layers, but I imagine something similar should be possible.
... View more
07-17-2023
12:06 PM
|
0
|
0
|
9048
|
| Title | Kudos | Posted |
|---|---|---|
| 2 | 01-18-2024 01:34 PM | |
| 1 | 09-13-2023 06:48 AM | |
| 1 | 09-23-2022 09:04 AM | |
| 1 | 06-14-2024 01:14 PM | |
| 2 | 09-24-2019 08:22 AM |