POST
|
I haven't found any applicable options in the web map. But if you use it in a web app, you can configure the visible scales there.
... View more
12-07-2020
05:16 AM
|
0
|
0
|
985
|
POST
|
You can't add an OBJECTID field to a query layer, you have to select one of the participating tables' OBJECTIDs. SELECT t1.OBJECTID, t1.field1, t2.field1 FROM ... AS t1 JOIN ... AS t2 ON ... You should be able to share that as a feature layer. However, I'm pretty sure you won't be able to publish it in a way that users can create new features. For that, you have to publish the original feature classes with write privileges (you can still hide fields).
... View more
12-07-2020
03:32 AM
|
0
|
0
|
2089
|
POST
|
In Python: def get_orientation(shape):
"""Returns a string describing the orientation ('NS', 'EW', or 'SQUARE') of the given feature geometry."""
extent = shape.extent
len_x = extent.XMax - extent.XMin
len_y = extent.YMax - extent.YMin
if len_x > len_y:
return 'EW'
if len_y > len_x:
return 'NS'
return 'SQUARE'
# do something with these values (e.g. calculate a field)
with arcpy.da.UpdateCursor(feature_class, ["SHAPE@", "Orientation"]) as cursor:
for shape, orientation in cursor:
orientation = get_orientation(shape)
cursor.updateRow([shape, orientation])
... View more
12-07-2020
03:25 AM
|
0
|
1
|
1712
|
POST
|
Thanks for the links! No, I don't have performance issues and I don't have to get to state 0. I'm just a little worried that this might signal some inconsistency within the database that'll bite my ass later on. I can only see the locks through SQL queries, ArcGIS Pro and ArcCatalog don't show any. Seems like disconnecting all users and compressing could do the trick. I'll talk to my server admin next week.
... View more
09-04-2020
06:33 AM
|
0
|
1
|
1913
|
POST
|
I have a versioned EGDB with only the DEFAULT version. When I compress the database, I never get below 8 states. Wondering about this, I investigated a bit and found that I have exclusive state locks from February this year, which stop these states being compressed. sqlexe = arcpy.ArcSDESQLExecute(r"my\database\connection.sde")
sqlexe.execute("SELECT state_id FROM sde.sde_states")
# 8 states
# [[0.0], [13388.0], [13394.0], [13389.0], [13390.0], [13391.0], [13392.0], [22930.0]]
query = "SELECT s.state_id, s.creation_time, s.closing_time, s.parent_state_id, l.lock_type, l.lock_time FROM sde.sde_states s JOIN sde.sde_state_locks l ON s.state_id = l.state_id"
for s in sqlexe.execute(query):
print(s)
# state_id, creation_time, closing_time, parent_state_id, lock_type, lock_time
# [13388.0, '07.02.2020 11:36:32', '07.02.2020 11:40:27', 0.0, 'E', '07.02.2020 11:36:32']
# [13389.0, '07.02.2020 11:40:27', '07.02.2020 11:52:08', 13388.0, 'E', '07.02.2020 11:40:27']
# [13390.0, '07.02.2020 11:52:08', '07.02.2020 11:55:08', 13389.0, 'E', '07.02.2020 11:52:08']
# [13391.0, '07.02.2020 11:55:08', '07.02.2020 12:00:17', 13390.0, 'E', '07.02.2020 11:55:08']
# [13392.0, '07.02.2020 12:00:17', '07.02.2020 12:00:18', 13391.0, 'E', '07.02.2020 12:00:17']
# [13394.0, '07.02.2020 12:04:34', '07.02.2020 12:04:45', 0.0, 'S', '07.02.2020 13:13:50']
# [22930.0, '03.09.2020 10:09:39', '03.09.2020 10:09:41', 13394.0, 'S', '03.09.2020 10:09:41']
# [22930.0, '03.09.2020 10:09:39', '03.09.2020 10:09:41', 13394.0, 'S', '03.09.2020 10:24:06']
# [22930.0, '03.09.2020 10:09:39', '03.09.2020 10:09:41', 13394.0, 'S', '03.09.2020 10:54:31']
# [22930.0, '03.09.2020 10:09:39', '03.09.2020 10:09:41', 13394.0, 'S', '03.09.2020 11:14:42']
As I understand it, exclusive locks (lock_type 'E') are created when editing data. The locked states have been closed, so the locks should have been lifted, right? What could have caused them to persist? Why does the shared lock (lock_type 'S') persist on state 13394? The current state is accessed by multiple services, but AFAIK there weren't any services running back in February. Is it because it's the parent of the current state? Should I worry about this? How can I get rid of these locks?
... View more
09-03-2020
02:52 AM
|
0
|
3
|
1965
|
POST
|
Thanks, you're right, of course. I just realized that I used this caveat myself in some old code to check whether I had an open edit session in ArcMap (point two UpdateCursors at the same dataset, if that produces an error, there is no edit session for that workspace).
... View more
08-26-2020
02:26 AM
|
0
|
0
|
2781
|
POST
|
# Just FYI:
# instead of this:
with ... as cursor:
for row in cursor:
a = row[0]
b = row[1]
c = row[2]
...
# you can just do this:
with ... as cursor:
for a, b, c in cursor:
...
... View more
08-24-2020
02:52 AM
|
0
|
0
|
2781
|
POST
|
You can't use multiple cursors at the same time. it MIGHT be possible, but in most cases it raises an error like the RuntimeError you got. The way to do this is to first pull the information from FC2 with a SearchCursor and then use an UpdateCursor to write the matching records into FC1. To find the matching records, a dictionary is the best way. See Jason's answer below.
... View more
08-24-2020
02:20 AM
|
0
|
2
|
2781
|
POST
|
It's not really clear to me what you're trying to do. You extract 3 fields from FC2 with a query. What do you want to do to FC1 and how does FC1 relate to FC2? Anyway, this won't work: row[1] == scursor[row[1]] arcpy.da.SearchCursor returns a generator object, not an iterable (like a list). You can turn the generator into a list, though: generator = arcpy.da.SearchCursor(FC2,fields,where_clause=expression)
print(generator)
actual_rows = [row for row in generator]
print(actual_rows)
# or short, because you probably don't need the generator:
actual_rows = [row for row in arcpy.da.SearchCursor(FC2, fields, expression)]
... View more
08-20-2020
07:07 AM
|
1
|
5
|
2781
|
IDEA
|
When symbolising line features, there is an effect to place markers at measured map units. This effect also supplies the option to have the markers offset from the line, but only in points. I would like to place markers with an offset measured in map units (e.g. meters), so that it doesn't depend on the map scale.
... View more
08-18-2020
01:21 AM
|
1
|
1
|
727
|
POST
|
I guess that was on line 5? Somehow I deleted an opening bracket... I updated the code above, please try again.
... View more
08-17-2020
10:15 PM
|
0
|
1
|
2946
|
POST
|
It's very unclear to me what you're trying to do. Dou you want to get characteristics (visibility, data source, name, etc.) of all/some layers in the map? set characteristics for all/some layers in the map? do something else with those layers? Do you need a graphical user interface?
... View more
08-17-2020
01:01 AM
|
0
|
0
|
765
|
POST
|
I tested the code and it works, so that's not the problem. It might have something to do with your selection, but the query seems straight enough... Maybe try this: pt_on_line = "D:\\WorkSpace\\POI\\Workspace.gdb\\COH_Address"
pt_on_line_ID = 'MasterID' # common ID field
pt_off_line = "D:\\WorkSpace\\POI\\Workspace.gdb\\COH_POI"
pt_off_line_ID = 'MASTER_ID' # common ID field
pt_on_line_dict = {str(row[0]):row[1] for row in arcpy.da.SearchCursor(pt_on_line, [pt_on_line_ID,"SHAPE@"])} # make dictionary, like {ID:geometry}
with arcpy.da.UpdateCursor(pt_off_line, [pt_off_line_ID, "SHAPE@"]) as cursor:
for row in cursor: # loop through points
if row[0]: # if row[0] is not None
try:
row[1] = pt_on_line_dict[str(row[0])] # move point geometry to match point geometry from dictionary
cursor.updateRow(row) # update the geometry
except KeyError:
print("key error: {} {} doesn't have a matching point!".format(pt_off_line_ID, row[0]))
... View more
08-17-2020
12:06 AM
|
1
|
3
|
2946
|
IDEA
|
I agree this should be available in arcpy. In the meantime, this works for SQL Server: sql = "select name from sys.objects where type_desc='SEQUENCE_OBJECT'"
sql_exe = arcpy.ArcSDESQLExecute(r"path\to\connection.sde")
for s_name in sql_exe.execute(sql):
print(s_name) More stuff to search for: sys.objects (Transact-SQL) - SQL Server | Microsoft Docs EDIT: The above only returns the sequence names. If you want to get things like the current value, you have to use sys.sequences. And some queries on that throw errors in arcpy. sys.sequences (Transact-SQL) - SQL Server | Microsoft Docs fields = ["start_value", "increment", "minimum_value", "maximum_value",
"is_cycling", "is_cached", "cache_size", "system_type_id", "user_type_id",
"precision", "scale", "current_value", "is_exhausted", "last_used_value"]
for f in fields:
try:
result = sql_exe.execute("select {} from sys.sequences".format(f))
print("{}:\tsucceeded".format(f))
except:
print("{}:\tfailed".format(f))
# start_value: failed
# increment: failed
# minimum_value: failed
# maximum_value: failed
# is_cycling: succeeded
# is_cached: succeeded
# cache_size: succeeded
# system_type_id: succeeded
# user_type_id: succeeded
# precision: succeeded
# scale: succeeded
# current_value: failed
# is_exhausted: succeeded
# last_used_value: failed
... View more
08-16-2020
11:03 PM
|
0
|
1
|
3112
|
POST
|
Hi Jim, I think you wanted to post that here: https://community.esri.com/community/geonet-member-introductions
... View more
08-12-2020
05:21 AM
|
0
|
0
|
725
|
Title | Kudos | Posted |
---|---|---|
1 | 07-14-2023 04:21 PM | |
1 | 02-23-2022 11:16 PM | |
1 | 05-30-2022 01:45 AM | |
1 | 08-16-2023 10:19 AM | |
1 | 05-24-2023 08:15 AM |
Online Status |
Offline
|
Date Last Visited |
02-03-2024
06:14 PM
|