POST
|
There are two ways you can do this. Both rely on typeKeywords. When you create a View, I believe a type keyword is automatically attached to it (this is true in the UI, at least). You can do something like this with your query string to filter out views: the_query = "NOT typekeywords:View Service AND owner:youruser" Or, in your loop you can use Item.typeKeywords to isolate views if you need to do further manipulations. The typeKeywords property for a view should be equal to a list like so: ['ArcGIS Server',
'Data',
'Feature Access',
'Feature Service',
'Service',
'Singlelayer',
'Hosted Service',
'View Service'] So, you can do: if "View Service" in item.typeKeywords do this or that.
... View more
01-18-2024
01:34 PM
|
0
|
0
|
212
|
POST
|
I think this one can be logged as a bug. The reference list is: layer_types = [
"ArcGISTiledMapServiceLayer",
"ArcGISImageServiceLayer",
"ArcGISImageServiceVectorLayer",
"ArcGISMapServiceLayer",
"ArcGISTiledImageServiceLayer",
"ArcGISVectorTileLayer",
] But the layerType attribute is set to "VectorTileLayer." From a quick glance at the source, it looks like "ArcGISVectorTileLayer" is only defined in arcgis/mapping/_types.py so I think the types are either incorrect or the logic needs to be updated to properly map to the types.
... View more
12-20-2023
02:02 PM
|
0
|
1
|
401
|
POST
|
I think I had to do this once. I'm not positive, but I think the process was something like this: Use Create Replica to download the data Run Append with the "Preserve Global IDs" environment setting. The limitation is going to be with #2. I believe eGDB appended to FGDB doesn't work, but not sure about FGDB to eGDB. You may need to experiment with a test case.
... View more
12-18-2023
02:59 PM
|
0
|
0
|
222
|
POST
|
You can do something like this: from arcgis.gis import GIS
gis = GIS("https://yourportal.com/portal", "portaladmin", "password")
hosting_server = gis.admin.servers.get(role="HOSTING_SERVER")[0] And then use hosting_server.system, which is a System Manager. The web_adaptors property, for example, returns: {'webAdaptors': [{'machineName': 'machine',
'machineIP': '10.29.77.176',
'webAdaptorURL': 'https://machine.domain.com/server',
'id': '4y0f8a80-01as-4e0e-bc6d-3d1234873c5',
'description': '',
'httpPort': -1,
'httpsPort': 443,
'refreshServerListInterval': 1,
'reconnectServerOnFailureInterval': 1,
'isAdminEnabled': True}]} Some other things you may find useful are "unregister_webadaptor" and "update_web_adaptors_configuration"
... View more
12-07-2023
06:06 AM
|
0
|
0
|
167
|
POST
|
In the past, I remember to_featureclass failing if you had any Python lists in your dataframe. I'm not sure if this is a problem in your case (only noting it because I see lists in the screen).
... View more
12-05-2023
10:52 AM
|
1
|
0
|
305
|
POST
|
Hey, your calc_expression value should be: {"field": "assetid", "sqlExpression": "CONCAT('NNTREE-', OBJECTID)"}
... View more
12-04-2023
07:13 AM
|
0
|
1
|
222
|
POST
|
I believe you can identify which records intersect one another with a spatial join. In my small test case, this works and returns the expected records: from arcgis import GIS
from arcgis.features import FeatureLayer
gis = GIS("https://machine.domain.com/portal", "user", "pass")
fl_url = "https://src.domain.com/server/rest/services/test/FeatureServer/0"
fl = FeatureLayer(fl_url, gis)
df = fl.query(as_df=True)
joined = df.spatial.join(
df.copy(),
how="left",
op="intersects",
left_tag="left",
right_tag="right"
)
intersecting_records = joined.loc[joined.OBJECTID_left != joined.OBJECTID_right] Hope this helps! This was a really good question that I'm sure many will get value from.
... View more
12-01-2023
12:21 PM
|
1
|
0
|
267
|
POST
|
As far as I can tell, everything seems to be in order. It's not really advertised, but you can do same-portal clones (I used to do this quite a bit for similar reasons). Some other things you can try are exporting the data or creating a replica. From there, you can prepare the data as you wish locally and then publish as usual. If it fails to do either one of those, maybe there will be an error that provides more insight.
... View more
12-01-2023
10:54 AM
|
2
|
0
|
238
|
POST
|
This IS possible, but you have to be very careful that you provide the exact JSON representation of your service (plus the update to the "schemaLockingEnabled" property) as a dict. I tested the below with good results, but I suggest you carefully review the service properties for correctness and use a test service to start. from arcgis.gis import GIS
gis = GIS("https://machine.domain.com/portal", "user", "pass")
hosting_server = gis.admin.servers.get(role="HOSTING_SERVER")[0]
services = hosting_server.services.list()
service = services[0]
# You can get the required dict for the edit from service.properties
# Review for accuracy as this update could break your service if there are
# any errors present
edit_dict = service.properties.__dict__["_mapping"]
edit_dict["properties"]["schemaLockingEnabled"] = "false"
service.edit(edit_dict)
... View more
11-29-2023
12:50 PM
|
1
|
0
|
219
|
POST
|
I've encountered this multiple times and it is usually a problem with dtypes or a rogue string that exceeds the maximum length of a field. Does everything work with a small subset of data?
... View more
11-28-2023
12:45 PM
|
0
|
1
|
519
|
POST
|
There's a few problems going on. The url param when initializing the GIS should be the url to your portal. Additionally, your feature_service_url is not pointing to a Feature Service, but a Feature Service Layer. You should remove "/2"
... View more
11-27-2023
07:10 AM
|
0
|
1
|
467
|
POST
|
Based on the error and other provided information, it seems you are working with a FeatureCollection Item and not a FeatureCollection object. Try doing this: from arcgis.features import FeatureLayerCollection
flc = FeatureLayerCollection.fromitem(flc_item) where "flc_item" is what you are currently working with
... View more
11-22-2023
01:31 PM
|
1
|
1
|
318
|
POST
|
Hey, glad those workarounds help. That's a fair question! The truth is, I'm just an enthusiast and I am in no way affiliated with the ArcGIS API for Python team. I understand your frustration - that's why I'm on these boards answering the questions I can as my time allows. Generally, it is preferable to open a case with Technical Support so the issue can be tracked both externally and internally. You may not be the only person running into this problem, so it is helpful to everyone to be able to add additional cases onto the defect log. Alternatively, you could post an issue on the public-facing github: https://github.com/Esri/arcgis-python-api You may or may not be able to get some more direct information on the expected behavior. In any case, it's still a good idea to log a formal defect and/or enhancement as the case may be.
... View more
11-20-2023
10:14 AM
|
0
|
0
|
307
|
POST
|
I observe the same thing on my end. Perhaps the best course of action might be to open a case with Technical Support to gain a better understanding of when the groupDesignations and url property values are populated and what they are supposed to be. My guess is this functionality may just be broken and a defect should be logged. For the groups, maybe you can do: ", ".join([group.Title for group in item.shared_with["groups"]]) And this would handle cases where the an item is shared to multiple groups. As for the WebMap url, if you're okay with linking to the Item Details page, then you can get that from "item.homepage". This will return something like: 'https://www.arcgis.com/home/item.html?id=d4d5c81e0ejkt4f68ac1aa77452a3338' If, however, you're after a direct link to the map I think you'll need to do some string interpolation/concatenation. Something like this if you are using the new Map Viewer: map_url = f"{gis.url}/apps/mapviewer/index.html?webmap={item.id}" Hope this helps.
... View more
11-20-2023
09:18 AM
|
0
|
2
|
323
|
POST
|
Accessing the database directly is likely the more efficient route in this case, especially since it seems many records are returned sometimes. If the main benefit of using the API is to do manipulations with pandas or something like that, you can also just do this by accessing the database directly. A related question was just asked the other day on how to load a feature class into a dataframe, for example: Re: Stand-Alone Table to Pandas Data Frame - Esri Community Anyhow, if you must use the ArcGIS API for Python I think the place you have to start is making sure the account running your ArcGIS Server has its own account in Portal with adequate permissions.
... View more
11-16-2023
09:40 AM
|
0
|
1
|
473
|
Title | Kudos | Posted |
---|---|---|
1 | yesterday | |
3 | Monday | |
1 | a week ago | |
1 | a week ago | |
1 | 12-01-2023 12:21 PM |