IDEA
|
Implementing a non-interactive way of doing SAML login defeats the whole purpose of SAML authentication. Please talk to your IT department about alternative methods of logging in. You can currently use ArcGIS Notebooks with GIS("home") or ArcGIS Pro login to script with SAML GIS("pro").
... View more
07-26-2023
03:33 AM
|
0
|
0
|
691
|
IDEA
|
This will be in version 2.2.0 released in Q4 of 2023 of the ArcGIS API for Python.
... View more
07-26-2023
03:29 AM
|
0
|
0
|
447
|
IDEA
|
You can pass service_name = <str> into to_featurelayer or import_data
... View more
08-16-2022
08:14 AM
|
0
|
0
|
2164
|
IDEA
|
06-29-2022
04:58 AM
|
0
|
0
|
1146
|
IDEA
|
You can create view on both tables and feature layers: from arcgis.features import FeatureLayerCollection, FeatureCollection
gis = GIS(profile='<login profile>')
item = gis.content.get("<item id>") # Table or Feature Layer Item
fs = FeatureLayerCollection.fromitem(item)
view_item = fs.manager.create_view(name='<Item Name>', spatial_reference=None, extent=None, allow_schema_changes=True, updateable=True, capabilities='Query', view_layers=None, view_tables=None, description=None, tags=None, snippet=None, overwrite=None, set_item_id=None)
... View more
07-08-2021
02:37 AM
|
0
|
0
|
563
|
POST
|
You cannot update the field names directly, you need to use a combination of update definition, add to definition and delete from definition to rename columns. Let's start with the update call. update_def = {
"fields": [
{
"name": "THISisWrong",
"type": "esriFieldTypeString",
"alias": "AmazingAlias",
"length": 256,
"editable": True,
"nullable": True,
"defaultValue": None,
"description": None,
"domain": None,
}
]
}
res = flyer.manager.update_definition(update_def)
print(res) This will update the alias column, though it doesn't directly answer your question. Now how can we take say column: ThisIsWrong and Rename it to this_is_wrong? or something like that. You'll have to do it in a few steps: Add the new field Copy the column data If field is uneditable, make it uneditable drop the old field import re
from arcgis.gis import GIS
from arcgis.features import FeatureLayer
def _camelCase_to_underscore(name):
"""PEP8ify name"""
if name[0].isdigit():
name = "execute_" + name
name = name.replace(" ", "_")
if '_' in name:
return name.lower()
s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
if __name__ == "__main__":
gis = GIS(profile='your_online_profile', verify_cert=False, trust_env=True)
item = gis.content.get("e0d177f6b2ed4b1db1abe848dfea23f8")
flyer = item.layers[0]
#
# Creating Columns with New Names
#
unchange_fields = [
v
for k, v in dict(flyer.properties).items()
if k in ['objectIdField', 'globalIdField']
]
rename_fields = [
dict(fld)
for fld in flyer.properties.fields
if fld["type"] not in ('esriFieldTypeOID', 'esriFieldTypeGlobalID')
or fld['name'] not in (unchange_fields)
]
expressions = []
delete_exp = {"fields": []}
add_fields = []
uneditable = []
for idx, fld in enumerate(rename_fields):
if _camelCase_to_underscore(fld["name"]) != fld["name"].lower():
expressions.append(
{
"field": _camelCase_to_underscore(fld["name"]),
"sqlExpression": fld["name"],
}
)
delete_exp["fields"].append({"name": fld["name"]})
fld['name'] = _camelCase_to_underscore(fld["name"])
fld['alias'] = _camelCase_to_underscore(fld["alias"])
if fld['editable'] == False:
uneditable.append(fld['name'])
fld['editable'] = True
add_fields.append(fld)
else:
print(f"Skipping field because it meets the format standards: {fld['name']}")
print("Add the renamed columns")
res = flyer.manager.add_to_definition({"fields": add_fields})
print(res)
print("Update the column values")
job = flyer.calculate(where="1=1", calc_expression=expressions, future=True)
result = job.result()
print(result)
# Set fields that are not editable back to original state.
#
update_editable = [fld for fld in add_fields if fld['name'] in uneditable]
if update_editable:
for fld in update_editable:
fld['editable'] = True
update_def = {"fields": update_editable}
res = flyer.manager.update_definition(update_def)
print(res)
# Drop the Old Fields
#
print(flyer.manager.delete_from_definition(delete_exp))
flyer._refresh()
print([fld['name'] for fld in flyer.properties.fields]) It should be noted that this code doesn't handle cases. If you have a field called Editor the caml casing should be editor. The underlying database sees the field as the same name and thus can't be renamed.
... View more
06-15-2021
04:38 AM
|
0
|
0
|
3165
|
IDEA
|
You can access the portal and server log via the admin endpoint for your enterprise.
... View more
04-24-2020
03:03 AM
|
0
|
0
|
786
|
IDEA
|
We are exploring this functionality for WMS, WMTS, GeoJSON, CSV and GeoRSS support in the map widget.
... View more
04-24-2020
02:47 AM
|
0
|
0
|
702
|
POST
|
Yes the python API does use the `time` module. This is not an easy fix since the API uses many 3rd party libraries as well who do `import time`, so there is no guarantee that if we modify code to not use `import time` that it would still not be an issue.
... View more
10-22-2018
08:17 AM
|
0
|
0
|
347
|
POST
|
Dan, I responded to your github issue: documentation on moving from spatialdataframe · Issue #315 · Esri/arcgis-python-api · GitHub Let me know if you have any other questions. Thanks Andrew
... View more
10-22-2018
05:23 AM
|
0
|
0
|
1683
|
POST
|
Ben, Since I can't see your URLs, I'm going to assume that is the issue. url = "http://mysite.com/server" # So it's net location / web adapter gis = GIS(url="http://mysite.com/portal", username="******", password='*******') sd = ServicesDirectory(url=url, portal_connection=gis) Even though this will work, accessing a server this way is not recommended. You would go through your GIS object instead since your site is federated. myservers = gis.admin.servers.list() It will return an array of server objects.
... View more
04-16-2018
08:11 AM
|
0
|
6
|
2300
|
POST
|
Joshua, Can you email me the URL you are using? achapkowski@esri.com Additionally, can you tell me what version you are using? I cannot reproduce your issue.
... View more
03-28-2018
10:47 AM
|
0
|
1
|
870
|
POST
|
Spencer and Joshua, Thank you for your comment/reply on using the Server class. Here is the best way to access your server: gis = GIS(url="https://mysite.com/portal", username='*****') servers = gis.admin.servers.list()
... View more
03-28-2018
03:28 AM
|
1
|
9
|
1498
|
Title | Kudos | Posted |
---|---|---|
1 | 07-24-2017 05:56 AM | |
1 | 03-28-2018 03:28 AM | |
1 | 07-24-2017 05:39 AM | |
1 | 06-01-2016 03:48 AM | |
1 | 01-27-2016 02:53 AM |
Online Status |
Offline
|
Date Last Visited |
08-30-2023
06:44 PM
|