|
POST
|
I have no experience in the creation of "script tool", but in scripts with python and arcpy I do. I would recommend try to make a old school debug technique: In the line 8 set print(lyrTemporalSamples) at least in that way you will know if the value is passed through the parameters. also validate the aprx variable, to know if the current map is taken.
... View more
11-16-2022
12:38 AM
|
0
|
0
|
1568
|
|
POST
|
I am using ArcGIS Pro 2.9.5, There is an Enterprise Geodatabase, with a FeatureClass (FC) configured with traditional versioned and WGS84 spatial reference(SR). Using FME a bunch of features (Set A) were added to a version in the FC, but those features were in a projected SR and were added with out any transformation. Then, another bunch of features (Set B) were added (using FME) in another version, but this ones were in WGS84. When I try to visualize the Set B in a map, no features are displayed, if I check the AttributeTable, the rows are shown, but if I select a row, and try to zoom to it, the zoom works, in some versions, if I try to flash the row, it works. but the feature per se is not displayed with the selected symbol. if I check the extend of the FC, I get: XMin (Left) -45.637716 XMax (Right) 457831.014000 YMin (Bottom) -23.808435 YMax (Top) 7380637.447000 spatialReference name (Geographic Coordinate System) GCS_WGS_1984 factoryCode (WKID) 4326 angularUnitName (Angular Unit) Degree datumName (Datum) D_WGS_1984 Despite the fact I deleted the version with the non-valid features, Set A, the extent remains the same. Moreover, I tried to use the tool RecalculateFeatureClassExtent the extent remains the same. If I create a new version and manually create features, they are drawn in the map. If I export the features in Set B to a FileGeodatabase, the features are well exported, and the result FC is shown in the map. If I tried to import another bunch of features (Set C) using FME in another version, the features shows the same problematic behavior described above. In some point the FC was deleted and recreated, it start working again, and showing the data in the map; but again, when the Set A were added, the odd behavior appear. Is there a way to fix the FC without recreating it? Is there a way to fix the versions?? I receive any suggestion. [EDIT 1] After a good amount of hours I found that the culprit is not FME. I was able to reproduce the behavior only using ArcGIS Pro: import arcpy
wkt = "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],\
PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]];\
-400 -400 1000000000;-100000 10000;-100000 10000;8.98315284119522E-09;\
0.001;0.001;IsHighPrecision"
myFgdb = r"c:\temp\Default.gdb"
sr = arcpy.SpatialReference(text=wkt)
arcpy.env.workspace = r"c:\temp"
foo = arcpy.management.CreateFeatureclass(myFgdb, "PointsWGS84", geometry_type="POINT", spatial_reference = sr)
# Creation of the point waaaaaaaaaay to far from the "boundaries" of WGS84
with arcpy.da.InsertCursor(r"c:\temp\Default.gdb\PointsWGS84", ["Shape@"]) as cur:
myPoint = arcpy.Point(459111.6681, 5010433.1285)
myArray = arcpy.Array([myPoint])
cur.insertRow(myArray)
del cur
desc = arcpy.da.Describe(foo)
print(desc["extent"])
# Creation of a point in the west side of the prime meridian
with arcpy.da.InsertCursor(r"c:\temp\Default.gdb\PointsWGS84", ["Shape@"]) as cur:
myPoint = arcpy.Point(-45.9111, 23.84006637)
myArray = arcpy.Array([myPoint])
cur.insertRow(myArray)
del cur if you run the snippet above, you will get a layer, open the attribute table and try to flash/zoom the second point. you will see no point. I tried to edit the point: just editing the vertices, but i did no modified per-se the values, just click and enter, then proceed to save the changes: Now the point is visible. I am not able to see the the real change in the table/FC (I have a lack of knowledge), but then I made the same operation in my Enterprise Geodatabase (There I now how to really know the stored value), and check the values after I changed some of my 13 features: As you can see the non changed values have negative values for X value, the changed ones under the sheets where modified by the addition of 360, but in ArcGIS Pro, the number appear as 27.415 W
... View more
11-14-2022
02:54 AM
|
0
|
0
|
913
|
|
POST
|
Hallo Darina, To be hones the error was solved by the IT guy that manage the corporate Firewall. I can tell you that a rule was created to allow communication with www.arcgis.com. You can check a detailed document for your whitelist here: https://downloads.esri.com/resources/enterprisegis/AGOL_Domain_Requirements.pdf
... View more
10-23-2022
09:26 PM
|
0
|
2
|
5039
|
|
POST
|
Now it is 2022, is there any information related to this issue?
... View more
10-07-2022
04:21 AM
|
0
|
1
|
1665
|
|
POST
|
@Anonymous User Thanks again, this will help me to improve the current script, but I will go in the direction of the locks, because this errors not only happens with the creation of domains.
... View more
10-05-2022
11:09 PM
|
0
|
0
|
1318
|
|
POST
|
@Anonymous User thanks for your answer. can you lead me where can I see the max allowed connections? currently I know for a fact that I am the only one connected to the geodatabase. Currently this issue happens to me when I am creating a geodatabase with a big schema that involves Tables, FeatureClasses, relationships, views, domains. the error happens in different parts of the execution. the proposed script above was a simple way to reproduce the behavior. The TableToDomain tool is not an option, because I need to create the table and insert the data therefore it will create more calls to the database. The idea behind this is to have an script that allows me to create a geodatabase.
... View more
10-05-2022
07:03 AM
|
0
|
2
|
1328
|
|
POST
|
1. Create a Enterprise geodatabase 2. Run the following code: import arcpy
arcpy.env.workspace = r"C:\temp2\DataOwner.sde"
# arcpy.env.autoCommit = 5
for i in range(0, 100):
arcpy.management.CreateDomain(arcpy.env.workspace, f"CG_Domain_{i}", f"CG_Domain_{i}", "TEXT", "CODED")
print(f"CG_Domain_{i}")
for j in range(0, 100):
arcpy.management.AddCodedValueToDomain(arcpy.env.workspace, f"CG_Domain_{i}", f"CG_Domain_Code_{j}", f"CG_Domain_Code_{j}")
print(f" CG_Domain_Code_{j}") 3. the script never ends successfully, always in some point it crash CG_Domain_0
CG_Domain_Code_0
CG_Domain_Code_1
CG_Domain_Code_2
CG_Domain_Code_3
CG_Domain_Code_4
Traceback (most recent call last):
File "C:/Users/svc_distripoint_nima/.PyCharmCE2019.1/config/scratches/scratch_1.py", line 10, in <module>
arcpy.management.AddCodedValueToDomain(arcpy.env.workspace, f"CG_Domain_{i}", f"CG_Domain_Code_{j}", f"CG_Domain_Code_{j}")
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 2652, in AddCodedValueToDomain
raise e
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 2649, in AddCodedValueToDomain
retval = convertArcObjectToPythonObject(gp.AddCodedValueToDomain_management(*gp_fixargs((in_workspace, domain_name, code, code_description), True)))
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 512, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: ERROR 000535: Workspace does not exist.
Failed to execute (AddCodedValueToDomain). Some of the domains were created, but it keep returning error, I want to check if this is related with the database, i can run a profiler (SQL Server profiler), but the databases are not my strongest skill. What should i look in that profiler, I mean which counters should i set ? Is there a known reason for this behavior? [EDIT 1]: following the documentation I decided to use the following 2 statements right after import of the arcpy module: arcpy.env.autoCommit = 100
arcpy.SetLogHistory(False) The result is the same.
... View more
10-04-2022
11:04 PM
|
0
|
4
|
1420
|
|
POST
|
1. Create a Enterprise geodatabase 2. Run the following code: import arcpy
arcpy.env.workspace = r"C:\temp2\DataOwner.sde"
# arcpy.env.autoCommit = 5
for i in range(0, 100):
arcpy.management.CreateDomain(arcpy.env.workspace, f"CG_Domain_{i}", f"CG_Domain_{i}", "TEXT", "CODED")
print(f"CG_Domain_{i}")
for j in range(0, 100):
arcpy.management.AddCodedValueToDomain(arcpy.env.workspace, f"CG_Domain_{i}", f"CG_Domain_Code_{j}", f"CG_Domain_Code_{j}")
print(f" CG_Domain_Code_{j}") 3. the script never ends successfully, always in some point it crash CG_Domain_0
CG_Domain_Code_0
CG_Domain_Code_1
CG_Domain_Code_2
CG_Domain_Code_3
CG_Domain_Code_4
Traceback (most recent call last):
File "C:/Users/svc_distripoint_nima/.PyCharmCE2019.1/config/scratches/scratch_1.py", line 10, in <module>
arcpy.management.AddCodedValueToDomain(arcpy.env.workspace, f"CG_Domain_{i}", f"CG_Domain_Code_{j}", f"CG_Domain_Code_{j}")
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 2652, in AddCodedValueToDomain
raise e
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 2649, in AddCodedValueToDomain
retval = convertArcObjectToPythonObject(gp.AddCodedValueToDomain_management(*gp_fixargs((in_workspace, domain_name, code, code_description), True)))
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 512, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: ERROR 000535: Workspace does not exist.
Failed to execute (AddCodedValueToDomain). Some of the domains were created, but it keep returning error, I want to check if this is related with the database, i can run a profiler (SQL Server profiler), but the databases are not my strongest skill. What should i look in that profiler, I mean which counters should i set ? Is there a known reason for this behavior? [EDIT 1]: following the documentation I decided to use the following 2 statements right after import of the arcpy module: arcpy.env.autoCommit = 100
arcpy.SetLogHistory(False) The result is the same.
... View more
09-29-2022
10:38 PM
|
0
|
1
|
867
|
|
POST
|
I am suffering from the same behavior: File ".\Arcpy\PublishService.py", line 9, in <module>
import arcpy
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\__init__.py", line 88, in <module>
from arcpy.geoprocessing import gp
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\__init__.py", line 14, in <module>
from ._base import *
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 14, in <module>
import arcgisscripting
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgisscripting\__init__.py", line 128, in <module>
from ._arcgisscripting import *
RuntimeError: The Product License has not been initialized. the characteristics of my environment: ArcGIS pro 2.9.3 ArcGIS Pro Named User License The processes were running with out issue, but since yesterday it start with this issue, as it can be seen in the code above, the error is triggered when the script reach the import arcpy command. An special consideration: I have a set of 5-6 scripts that runs over 4 geodatabases, all of them are orchestrated to be run sequentially by a service (the service runs under the same credentials as the ArcGIS Pro application was configured and executed - you know...the profile cookie mentioned above), but not all the scripts fail, and the failing ones are not always the same. I even have a script made in PowerShell that uses the ArcGIS.Core.Hosting.dll, it is failing too when the initialization is called.
... View more
09-28-2022
01:54 AM
|
0
|
5
|
6138
|
|
POST
|
The information that is required was moved to the GDB_ITEMS table, it can be fetched with a cursor: identifier = None
with arcpy.da.SearchCursor(os.path.join(arcpy.env.workspace,"sde.GDB_ITEMTYPES"), ['UUID'], where_clause="Name = 'Location Referencing Dataset'") as type_items_cursor:
for type_object in type_items_cursor:
identifier = type_object[0]
del type_items_cursor
lrs_path = None
with arcpy.da.SearchCursor(os.path.join(arcpy.env.workspace,"sde.GDB_ITEMS"), ['Path'], where_clause=f"Type = '{identifier}'") as items_cursor:
for item in items_cursor:
lrs_path = item[0]
del items_cursor
print(lrs_path)
... View more
09-27-2022
11:28 PM
|
0
|
0
|
953
|
|
POST
|
Moreover, I just change the name of the LRS......the name was not changed in the LRS_Metadata table......so.....programmatically speaking......how i am going to be able to retrieve the name of the LRS, in order to apply the script above?? [EDIT 1] I tried with ListDatasets..... no luck
... View more
09-19-2022
05:02 AM
|
0
|
0
|
1014
|
|
POST
|
Prior, (I can confirm in version 2.8), I could check the LRS metadata using a query to the LRS_METADATA table in a Enterprise geodatabase. import xml.etree.ElementTree as ET
import arcpy
import os
arcpy.env.workspace = r""
arcpy.env.workspace = r"U:\Documents\ArcGIS\Projects\UPDM2018\LIN0228\UPDM2018_DataOwner.sde"
def is_table_in_LRS(tablename):
with arcpy.da.SearchCursor(os.path.join(arcpy.env.workspace, "LRS_METADATA"), ['Metadata']) as cursor:
for row in cursor:
raw_metadata = row[0].tobytes()
xml = str(raw_metadata.decode("utf-8"))
root = ET.fromstring(xml)
event_tables = [elem.get('TableName') for elem in root.iter('EventTable')]
print(event_tables)
return tablename in event_tables
res = is_table_in_LRS("MyTable")
print(res) Using ArcGIS Pro 2.9, I added an event table to my LRS, and tried the script above, but as result i just got the list of event tables without the new one. after restarting arcgis pro, my Ide, checking the properties of the LRS and the properties of the Feature class, i was pulling my hair because the visual information from ArcGIS pro was correct, but the information from the script was not. After making a double check in the documentation, i found here, that i can get the lrs metadata using the arcpy.Describe method. import xml.etree.ElementTree as ET
import arcpy
import os
arcpy.env.workspace = r""
arcpy.env.workspace = r"U:\Documents\ArcGIS\Projects\UPDM2018\LIN0228\UPDM2018_DataOwner.sde"
def is_table_in_LRS(tablename):
desc = arcpy.Describe(os.path.join(arcpy.env.workspace, "UPDM2018.Dataowner.P_Integrity\\UPDM2018.Dataowner.ALRS"))
xml = desc.lrsMetadata
root = ET.fromstring(xml)
event_tables = [elem.get('TableName') for elem in root.iter('EventTable')]
print(event_tables)
return tablename in event_tables
res = is_table_in_LRS("P_DASurveyReadings")
print(res) ok, that is good. I want to know, where it is stored? can i get rid of the LRS_METADATA table? I would like to make this script but in SQL, where should i look for the REAL Lrs metadata?
... View more
09-19-2022
04:46 AM
|
0
|
2
|
1020
|
|
POST
|
I t has been some time since this question was created, but a stump with the same error. does anyone has a clue how to tackle this?
... View more
06-07-2022
11:09 PM
|
0
|
0
|
585
|
|
POST
|
do you mean to change configuration for the logging process in the SQL server?
... View more
06-01-2022
11:17 PM
|
0
|
1
|
1321
|
| Title | Kudos | Posted |
|---|---|---|
| 2 | 12-01-2023 02:45 AM | |
| 1 | 07-19-2021 11:25 PM | |
| 1 | 07-21-2023 04:44 AM | |
| 1 | 07-07-2023 05:15 AM | |
| 1 | 01-19-2023 03:19 AM |
| Online Status |
Offline
|
| Date Last Visited |
08-02-2024
12:42 AM
|