|
POST
|
Is this what you're trying to do? import requests
from arcgis import GIS
from arcgis.features import FeatureLayerCollection
url = "https://pythonapi.playground.esri.com/server/rest/services/Hosted/Ports_in_the_Western_US/FeatureServer"
gis = GIS("https://pythonapi.playground.esri.com/portal", "arcgis_python", "amazing_arcgis_123")
flc = FeatureLayerCollection(url, gis)
replica = flc.replicas.create(
replica_name = 'arcgis_python_api_ports',
layers='0',
sync_model="perLayer",
target_type="server",
data_format="sqlite",
asynchronous=True
)
status_url = replica["statusUrl"]
params = {
"f": "json",
"token": gis._con.token
}
r = requests.post(status_url, params=params)
Where you can then use r.json() to get a json response from the status url: {'responseType': 'esriReplicaResponseTypeData',
'replicaID': '037B207A-4E7B-423C-AC99-F9EE3AAE96E6',
'replicaName': 'arcgis_python_1696596866617',
'resultUrl': 'https://pythonapi.playground.esri.com/server/rest/directories/arcgisjobs/system/synctools_gpserver/je1fb0eacd85444baae62274cd6ea9811/scratch/_ags_data5464957EDC9346558F5FFEA3DCE5AEBC.geodatabase',
'transportType': 'esriTransportTypeURL',
'targetType': 'server',
'lastUpdatedTime': 1696596867000,
'layerServerGens': [{'serverGen': 1696596865593, 'id': 0, 'serverSibGen': 0}],
'submissionTime': 1696596865000,
'status': 'Completed'}
... View more
10-06-2023
05:59 AM
|
1
|
1
|
1700
|
|
POST
|
There's some examples here: Editing Features | ArcGIS API for Python. No SDE connection required. Your code would change to something like this import arcgis
from arcgis.features import FeatureLayer
gis = GIS("https://xxxxxxx/portal", "username", "password")
fl_url = "https://xxxxxx/env/rest/services/DEV/VDEQ_Petro_Tank_Facility_DEV/FeatureServer/0"
fl = FeatureLayer(fl_url, gis)
...other logic...
fl.edit_features(adds=YOUR_ADDS, deletes=YOUR_DELETES, updates=YOUR_UPDATES) Where the adds, deletes, updates are a FeatureSet object, or a list of features in json form (I think you basically have this already with your JSON).
... View more
10-05-2023
06:04 PM
|
1
|
2
|
6426
|
|
POST
|
From your sample, you're already using the api for login purposes. Why don't you give the edit_features method a shot with your json and see if that produces different results? I don't observe the same behavior using just the API, so I think at least part of the problem may be missing headers.
... View more
10-05-2023
10:16 AM
|
0
|
4
|
2857
|
|
POST
|
Okay, I think maybe I understand. You might be confusing ArcPy with the ArcGIS API for Python? For ArcPy you would most likely edit data directly using an sde connection file. The ArcGIS API for Python, on the other hand, is just a wrapper for the REST API that makes it easier to use. I guess the only way you wouldn't be able to use it for this purpose is if you are working with a standalone ArcGIS Server. Otherwise, you would simply log into your portal, load the target Feature Layer, and use the FeatureLayer object's "edit_features" method to accomplish a similar result.
... View more
10-05-2023
08:50 AM
|
0
|
6
|
2860
|
|
POST
|
Out of curiosity have you attempted the equivalent workflow using the ArcGIS API for Python? I realize you may have your reasons for using the REST API directly, but thought I would ask in case there's a possibility that might work better. The Python API will be a little different through the use of requests.Session (I'm pretty sure) and headers. I'm certain there is some configuration that is missing here that is giving you these odd results.
... View more
10-04-2023
02:17 PM
|
0
|
9
|
3605
|
|
POST
|
Just an observation - I don't know if it's significant - but one difference between the two methods is the header. Maybe looking into the differences between the two requests could yield some useful information.
... View more
10-04-2023
09:41 AM
|
0
|
12
|
3629
|
|
POST
|
Are you certain the problem is on the json.loads side? When you load from the files, does the count match what you expect? I suspect the problem is actually on the append side. I've encountered similar issues in the past when attempting to add several thousand records all at once. My solution was to apply the edits in batches (of 500 or so).
... View more
10-04-2023
08:17 AM
|
0
|
1
|
3642
|
|
POST
|
This is a really simplified example, but you can accomplish this using only the ArcGIS API for Python like so: import pandas as pd
from arcgis.features import GeoAccessor, GeoSeriesAccessor
from arcgis.gis import GIS
from arcgis.mapping import WebMap
gis = GIS("https://machine.domain.com/portal", "admin", "password")
df = pd.read_csv("/path/to/sample.csv") # or pd.read_excel
sedf = pd.DataFrame.spatial.from_xy(df=df, x_column="LONGITUDE", y_column="LATITUDE", sr=4326)
lyr = sedf.spatial.to_featurelayer("csv_featureLayer", gis=gis)
wm = WebMap()
wm.add_layer(lyr)
item_properties = {"title":"CSV test", "snippet": "whatever", "tags": ["automation", "python"]}
wm_item = wm.save(item_properties)
... View more
09-29-2023
07:07 AM
|
0
|
0
|
638
|
|
POST
|
To get that information, you can take a look at the item data. Example: from arcgis import GIS
import json
conn = GIS("https://machine.domain.com/portal", "admin", "password")
item = conn.content.get(<itemID>)
item_data = item.get_data()
# Include the below line for prettified JSON
print(json.dumps(item_data, indent=4, sort_keys=True)) In your case, the information you're looking for will be in: item_data["operationalLayers"]
... View more
09-29-2023
06:36 AM
|
1
|
1
|
1270
|
|
POST
|
Have you considered just using FeatureLayer? If you know ahead of time what the URL is, you don't have to search for it. from arcgis import GIS
from arcgis.features import FeatureLayer
gis = GIS()
url = "https://urlforlayer/0"
fl = FeatureLayer(url, gis)
... View more
09-28-2023
07:09 AM
|
0
|
1
|
7254
|
|
POST
|
I think instead of LEFT you can use SUBSTRING. This is the best information I'm aware of regarding SQL support: Enforce standardized SQL queries—ArcGIS Server | Documentation for ArcGIS Enterprise Standardized SQL functions in ArcGIS Online—ArcGIS Online Help | Documentation I believe this is only supported 10.9+ when 'supportsOutFieldSqlExpression' was added.
... View more
09-22-2023
07:55 AM
|
0
|
0
|
725
|
|
POST
|
Sorry to ask the obvious, but does that query return records? Everything seems to be in order in your screen.
... View more
09-21-2023
07:06 AM
|
0
|
0
|
702
|
|
POST
|
Hey, if I'm reading the documentation correctly then if you want everything appended to a FeatureLayer you need to supply a FeatureLayer object, not string to output_name. Seems like the failed process already created an initial Feature Layer for you? Use that for output_name and see what happens.
... View more
09-21-2023
06:36 AM
|
0
|
0
|
931
|
|
POST
|
I think you can reasonably simulate the same result for your case. Instead of going through Portal you publish directly to Server and copy the data. It seems like you're publishing single raster datasets? That should be fine under your licensing. All you should have to do to is make some minor changes to your CreateImageSDDRaft function.
... View more
09-20-2023
02:23 PM
|
0
|
0
|
3011
|
|
POST
|
I believe the problem you're facing is CreateImageSDDRaft is meant for publishing to ArcGIS Server. There's a required "connection_file_path" parameter I think you're missing which points to the path of an .ags connection file. To my knowledge, it is possible to publish through Portal using a different workflow that relies on the ArcGIS API for Python: Create Imagery Layers | ArcGIS API for Python. However, I believe in order to make use of this approach you need to have a portal configured for Raster Analysis.
... View more
09-20-2023
07:11 AM
|
1
|
0
|
3024
|
| 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 |