POST
|
My goal is to create a script that applies a definition query to multiple layers in ArcGIS Pro. I was able to successfully create a script (not the most elegant) in ArcMap and not knowing that the GUI is different in Pro and causing errors to my script. I'm new to Python and doing my best to recreate this script in ArcGIS Pro, but having difficulty especially using the listLayer. Any help would be greatly appreciated! Here's my script created in ArcMap: mxd = arcpy.mapping.MapDocument("CURRENT")
layers = arcpy.mapping.ListLayers(mxd,"CONDO_1ST_LEVEL*")
#replace subcode here
query = '"SUBCODE" =\'1172\''
layers[0].definitionQuery=query
print layers [0].definitionQuery
mxd = arcpy.mapping.MapDocument("CURRENT")
layers = arcpy.mapping.ListLayers(mxd,"CONDO_2ND_LEVEL*")
#replace subcode here
query = '"SUBCODE" =\'1172\''
layers[0].definitionQuery=query
print layers [0].definitionQuery
mxd = arcpy.mapping.MapDocument("CURRENT")
layers = arcpy.mapping.ListLayers(mxd,"CONDO_3RD_LEVEL*")
#replace subcode here
query = '"SUBCODE" =\'1172\''
layers[0].definitionQuery=query
print layers [0].definitionQuery
mxd = arcpy.mapping.MapDocument("CURRENT")
layers = arcpy.mapping.ListLayers(mxd,"CONDO_4TH_LEVEL*")
#replace subcode here
query = '"SUBCODE" =\'1172\''
layers[0].definitionQuery=query
print layers [0].definitionQuery
mxd = arcpy.mapping.MapDocument("CURRENT")
layers = arcpy.mapping.ListLayers(mxd,"CONDO_5TH_LEVEL*")
#replace subcode here
query = '"SUBCODE" =\'1172\''
layers[0].definitionQuery=query
print layers [0].definitionQuery
Here's my attempt to convert the script to version 3 to use in ArcGIS Pro: aprx = arcpy.mp.ArcGISProject("CURRENT")
lyr = m.listLayers(aprx,"CONDO_1ST_LEVEL*")[0]
#replace subcode here
query = '"SUBCODE" =\'1172\''
m.listLayers[0].definitionQuery=query
print (layers [0].definitionQuery)
aprx = arcpy.mp.ArcGISProject("CURRENT")
lyr = m.listLayers(aprx,"CONDO_2ND_LEVEL*")[0]
#replace subcode here
query = '"SUBCODE" =\'1172\''
m.listLayers[0].definitionQuery=query
print (layers [0].definitionQuery)
aprx = arcpy.mp.ArcGISProject("CURRENT")
lyr = m.listLayers(aprx,"CONDO_3RD_LEVEL*")[0]
#replace subcode here
query = '"SUBCODE" =\'1172\''
m.listLayers[0].definitionQuery=query
print (layers [0].definitionQuery)
aprx = arcpy.mp.ArcGISProject("CURRENT")
lyr = m.listLayers(aprx,"CONDO_4TH_LEVEL*")[0]
#replace subcode here
query = '"SUBCODE" =\'1172\''
m.listLayers[0].definitionQuery=query
print (layers [0].definitionQuery)
aprx = arcpy.mp.ArcGISProject("CURRENT")
lyr = m.listLayers(aprx,"CONDO_5TH_LEVEL*")[0]
#replace subcode here
query = '"SUBCODE" =\'1172\''
m.listLayers[0].definitionQuery=query
print (layers [0].definitionQuery)
... View more
11-03-2017
11:47 AM
|
0
|
2
|
3389
|
POST
|
Thank you so much for identifying the issue and reporting it, thought I was going crazy!
... View more
09-25-2017
09:11 AM
|
0
|
0
|
3723
|
POST
|
Dan, thanks so much for responding. As far as I can tell my labels are turned on. I've right click onto my feature an turned the labels on that way....also clicked onto the labels icon in the upper left to turn them on as well and still the label placement is grayed out.
... View more
09-20-2017
07:35 PM
|
0
|
1
|
3723
|
POST
|
I'm using Scene in ArcGIS Pro and I don't understand why my Label Placement is grayed out even though I've selected my Feature Class in the Contents panel and the Maplex Label Engine is checked? I'm new to Pro and could be missing something obvious. arcgis-pro
... View more
09-19-2017
08:06 AM
|
5
|
25
|
9044
|
POST
|
Hi Russell, Is there a way to align my hosted feature class with the 3D terrain layer in Scene Viewer without Pro?
... View more
08-31-2017
12:26 PM
|
0
|
1
|
357
|
POST
|
It works!!! Thanks sooo very much for your help on this issue!!!!
... View more
08-11-2017
08:35 AM
|
1
|
0
|
357
|
POST
|
In Windows Explorer, I right click on the .gdb and zip. Uploaded the file and still no results in SV. I’ve added this file to the group.
... View more
08-09-2017
11:20 AM
|
0
|
2
|
357
|
POST
|
I saved my output feature class in a file geodatabase (wasn’t before). Using Windows Explorer, I zipped the file and uploaded to AGOL as a ‘File Geodatabase’, but getting this error. I’ve added the zipped file to the Group.
... View more
08-08-2017
02:05 PM
|
0
|
4
|
357
|
POST
|
I’m zipping the shapefile right out of Window Explorer. In ArcScene, it shows my file as a multipatch feature class
... View more
08-08-2017
12:24 PM
|
0
|
6
|
630
|
POST
|
If this helps, I’ve documented my steps and included illustrations: 1. Add Shapefile to ArcScene 2. Go to Layer Properties and Extrude, Apply and Save 3. Run the Layer 3D to Feature Class Tool 4. Zip files in Windows Explorer 5. Upload Zipped file to AGOL; Publish as a Scene Layer, display as Global Scene 6. Open in Scene Viewer; Configure layer; Save Scene 7. I don’t see my Layer
... View more
08-08-2017
09:56 AM
|
0
|
8
|
630
|
POST
|
Yes, I extruded then ran the Layer 3D to Feature Class tool. I’m perplex because I believe I’m doing everything right and yet I cannot even see this layer in Scene Viewer. Are you able to even see it?
... View more
08-08-2017
08:15 AM
|
0
|
0
|
630
|
POST
|
I decided to create a fresh layer. Went through the steps, but just not seeing my layer in Scene Viewer. I deleted the old Group and created a new one. I’ve added my hosted Scene Layer along with the source. So sorry to keep bugging you on this…and appreciate you hanging in there with me!
... View more
08-07-2017
02:27 PM
|
0
|
11
|
630
|
POST
|
Think my issue is “Zip the gdb”. Up to this point, I would zip my files through Windows Explorer. I didn’t realize I could/should zip directly in ArcCatalog. I’m using the tool Compress File Geodatabase Data, however I keep receiving the following error (below). Are you zipping your File Geodatabase through Catalog this way?
... View more
08-07-2017
01:25 PM
|
0
|
13
|
630
|
POST
|
So if I’m understanding you correctly, I shouldn’t convert my Feature Class to 3D in ArcScene? Sorry, this is all new to me! 1. Add feature class to ArcScene (I don’t have Pro) 2. Extrude polygon 3. Export Feature Class and zip 4. Upload to AGOL 5. Publish hosted scene layer 6. View in Scene
... View more
08-07-2017
12:04 PM
|
0
|
15
|
449
|
POST
|
Okay, thanks for looking into this! Sure, if you wouldn’t mind sharing that file I’d appreciate it!
... View more
08-07-2017
10:27 AM
|
0
|
1
|
449
|
Title | Kudos | Posted |
---|---|---|
5 | 09-19-2017 08:06 AM | |
2 | 04-06-2018 12:08 PM | |
1 | 02-20-2018 02:25 PM | |
3 | 02-14-2018 06:07 AM | |
2 | 12-18-2017 08:02 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:25 AM
|