|
POST
|
Yes, agreed. I was able to zoom to extents on the active view. But there's no way to do this on a map view that is not active or when working with a project that is not currently open in ArcGIS Pro. thanks
... View more
12-10-2020
01:27 PM
|
0
|
0
|
6275
|
|
POST
|
I got this working. It seems the problem was in the parameter definition: shapesUsedFromLayer = arcpy.Parameter(
displayName="Selected Shape(s) Will Be Used From This Layer",
name="shapesUsedFromLayer",
datatype="GPFeatureLayer", #"GPString",
parameterType="Required",
direction="Input") I had the parameter as GPString instead of GPFeatureLayer. I also removed references to inLayer and just used selLyr (from the parameter).
... View more
12-10-2020
07:46 AM
|
1
|
0
|
1107
|
|
POST
|
Is it still the case that zoom to extent on the map view is not supported in arcpy? So far, my searching makes me think that it is not. thanks @JoshuaBixby
... View more
12-10-2020
07:39 AM
|
0
|
4
|
6278
|
|
POST
|
Thanks. I'll dig into this some more and update. Thanks for the tip on using 'memory' too.
... View more
12-01-2020
11:32 AM
|
0
|
0
|
1160
|
|
POST
|
Hello everyone, I have a procedure which takes a selected shape(s) from a layer and creates a copy of the shape in a different feature class. This procedure worked fine in desktop 10.5 and I am now trying to modify it to use in Pro 2.6.2. The code works fine and it copies the shape into the other feature class but what isn't working is that the parcel which I copied the first time, continues to be copied in subsequent tests (even though I'm selecting different parcels). Below is a picture of the layer that the parcel to be copied is selected from. I have done numerous tests, each one selecting a different parcel. Below is a picture of the feature class where the shapes are copied to. All of the records in the attribute table have the same parcel location (even though I selected different parcels above). Here is the script: def CreateShapes(item, mapType, selLyr, dType, dbPath, proj, mapName, luCode=None):
arcpy.env.overwriteOutput = True
aprx = arcpy.mp.ArcGISProject(proj)
m = aprx.listMaps(mapName)[0]
inLayer = m.listLayers(selLyr)[0]
#Get a count of how many shapes are selected
resultSelShapes = arcpy.GetCount_management(inLayer)
countSelShapes = int(resultSelShapes.getOutput(0))
arcpy.AddMessage('Number of rows in inLayer: {}'.format(str(countSelShapes)))
#create in_memory feature class
tempFc = 'in_memory/tempFc'
arcpy.CreateFeatureclass_management('in_memory','tempFc','POLYGON')
if dType != 'NotRequired':
#dissolve shapes
arcpy.Dissolve_management(in_features=inLayer, out_feature_class=tempFc,
multi_part=dType, unsplit_lines="DISSOLVE_LINES")
#Get a count of how many shapes are in the post dissolve in memory feature class
resultTempFc = arcpy.GetCount_management(tempFc)
countTempFc = int(resultTempFc.getOutput(0))
arcpy.AddMessage('Number of rows in tempFc: {}'.format(str(countTempFc)))
polyGeom = []
with arcpy.da.SearchCursor(in_table=tempFc, field_names='SHAPE@') as sCur:
for row in sCur:
polyGeom.append(row[0])
arcpy.AddMessage('polyGeom.append(row[0]): {}'.format(row[0]))
del sCur
if mapType == 'Land Use Amendment':
with arcpy.da.InsertCursor(in_table=dbPath + r'\PEYTO.PLANNING.PLAN_SITE_MNT',
field_names=['APPLICATION_TYPE','ITEM','IS_VALID','SHAPE@']) as iCur:
for poly in polyGeom:
iCur.insertRow((mapType,item,'Y',poly))
del iCur
with arcpy.da.InsertCursor(in_table=dbPath + r'\PEYTO.PLANNING.PLAN_LU_BOUNDARY_MNT',
field_names=['ITEM','STATUS','LU_CODE','IS_VALID','SHAPE@']) as iCur2:
for poly in polyGeom:
iCur2.insertRow((item,'PENDING',luCode,'Y',poly))
del iCur2
arcpy.AddMessage('Create Shapes procedure passed.')
return True
else:
with arcpy.da.InsertCursor(in_table=dbPath + r'\PEYTO.PLANNING.PLAN_SITE_MNT',
field_names=['APPLICATION_TYPE','ITEM','IS_VALID','SHAPE@']) as iCur:
for poly in polyGeom:
iCur.insertRow((mapType,item,'Y',poly))
del iCur Appreciate any ideas as to why the parcel being selected isn't the one being inserted into the other feature class. Thanks
... View more
11-30-2020
08:56 PM
|
0
|
3
|
1195
|
|
POST
|
Thanks. Missing an end bracket. Funny how you can stare and stare and stare at it and it just doesn't pop out!
... View more
11-13-2020
07:36 AM
|
0
|
0
|
1753
|
|
POST
|
Hello, Can anybody see why I'd be getting a syntax error here? Totally stumped? Thanks
... View more
11-13-2020
07:14 AM
|
0
|
3
|
1763
|
|
POST
|
True. So I came up with the following: When the active view is a map it displays the map name and when the active view is a layout it displays the layout name. I was thinking that getting the name of the active layout should be mv.layout.name but no it's just mv.name Logically it doesn't really make sense to me, but it works and I'm happy with that. Thanks for all your help
... View more
11-10-2020
03:34 PM
|
1
|
0
|
5455
|
|
POST
|
ah .map.name I was trying just .name Suppose it makes sense when you think about it though. Are these properties documented anywhere? Then only documentation I could find about activeView is basicallly the page I linked in the original question. Thanks!
... View more
11-10-2020
02:20 PM
|
0
|
2
|
5455
|
|
POST
|
Once I've got the activeView how do I grab the name of the MapView or Layout?
... View more
11-10-2020
01:00 PM
|
0
|
4
|
5455
|
|
POST
|
Just did, thanks. Had been away from my computer...
... View more
11-10-2020
11:19 AM
|
0
|
0
|
5455
|
|
POST
|
I'm stumped. The following documentation says activeView will return the active MapView or Layout. I've searched high and low trying to find code to use which will tell me If the "active view" is a map or a layout but am having zero luck. Any insight appreciated. Thanks! MapView—ArcGIS Pro | Documentation
... View more
11-10-2020
09:44 AM
|
0
|
9
|
5491
|
|
POST
|
Thanks for the info Dan. I was able to get upgraded to 2.6.2 last Friday and can now use activeView (yay).
... View more
11-09-2020
01:03 PM
|
0
|
0
|
4046
|
|
POST
|
Hello, I am using Arcgis Pro 2.4.3 and have the following code: aprx = arcpy.mp.ArcGISProject("CURRENT") mv = aprx.activeMap arcpy.AddMessage(mv.name) I'm using this to get the active map window, but what I'm having trouble figuring out is how do I determine if the "active" window is a layout window. If the above is used on a layout window it will return the name of the map that the active map frame is based on in the layout. It's tricky searching the online documentation when I'm not using the current version of Pro. There is a activeView property which I think does what I want to do, but I don't think it's available in 2.4.3. Thanks!
... View more
11-03-2020
09:53 PM
|
0
|
2
|
4077
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 11-10-2020 03:34 PM | |
| 1 | 02-23-2021 11:53 AM | |
| 1 | 02-16-2021 09:15 AM | |
| 1 | 12-10-2020 07:46 AM | |
| 1 | 01-18-2019 09:54 AM |
| Online Status |
Offline
|
| Date Last Visited |
04-22-2021
04:31 PM
|