POST
|
Hello Lev: I've been using Pro 2.0.1 now and I ran into the same question as you did. I saw this thread and I came up with a solution, though it might not suit for every cases, but it is still a solution! The idea is that inside the arcpy.mp layer class(the class you use Map.listLayers()[0] to get) there's a property called symbology. It has read and write access. So what you can do is to pre-set a symbology lyrx file and add it as layer class into map class, then extract it's symbology as a variable. Then you remove this symbology layer, add the layer you really want, assign the symbology variable as the new value for the layer's symbology property. Then you save it and export images. Here is my code: output_aprx = arcpy.mp.ArcGISProject(output_aprx_pth)# read it as object using arcpy, then to modify it #Working on converting input feature class to a layer inside aprx project file Map = output_aprx.listMaps("Map")[0] Layout = output_aprx.listLayouts()[0] title = Layout.listElements("TEXT_ELEMENT")[0]# Get the title object title.text = "DC "+ outname# Change the text message of title to what we want if symbology == 0: Map.addLayer(input_lyrF, "TOP") else: sym_lyrF = arcpy.mp.LayerFile(symbology) Map.addLayer(sym_lyrF, "TOP") sym_layer = Map.listLayers()[0] sym_obj = sym_layer.symbology Map.removeLayer(sym_layer) Map.addLayer(input_lyrF) input_layer = Map.listLayers()[0] input_layer.symbology = sym_obj output_aprx.save()# Save the edits Layout.exportToJPEG(outmaps_path + name_element + ".jpg", resolution = out_resolution) I tried it on simple symbol and graduate color, everything works fine.
... View more
01-14-2018
09:09 PM
|
1
|
3
|
453
|
POST
|
That's too bad to hear. Especially the ArcGIS Pro's python is always not up-to-date.
... View more
01-14-2018
06:30 PM
|
0
|
3
|
602
|
POST
|
Dear Shaun: I was working on ArcGIS Pro 2.0.1 version and I also could not import arcpy to another Python version. I used every method you instructed, like adding the arcpy.pth and ArcGISProBin.pth, I also copied three pyd files. When I import arcpy, the outside python will stop working. Because of the nature of my work I have to call arcpy from outside python. I'm using the same python version as the ArcGIS Pro python. If you know where the problem is, let me know! Thank you!
... View more
01-14-2018
01:09 PM
|
2
|
0
|
602
|
Title | Kudos | Posted |
---|---|---|
1 | 01-14-2018 09:09 PM | |
2 | 01-14-2018 01:09 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:25 AM
|