POST
|
Is it possible to make a dashboard, with a free license here, arcgisonline? Os just webmaps?
... View more
04-14-2020
05:29 AM
|
0
|
1
|
351
|
POST
|
I tired, but didnt work. Something was wrong, i fixed, line 4, requires no colon : at the end But still doesnt work. Changes the extent, but doesnt export pdf. What is wrong? mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0]
lyr = arcpy.mapping.ListLayers(mxd)[0]
rows = arcpy.SearchCursor(lyr.dataSource)
for row in rows:
newDFExt = row.getValue("Shape").extent
df.extent = newDFExt
arcpy.mapping.ExportToPDF(mxd, r"D:\TEMP\datadriven")
del mxd
... View more
01-10-2018
11:27 AM
|
0
|
1
|
2168
|
POST
|
My model iterate through many shapefiles: First it Checks if, the field i want to add (model parameter), already exists in the table (check if the field name is the same) If dont exist: great! Just add the field i want. If exists: creates a temp field Store the the value from the existing field in the temp field Drop the existing field Create the field i want, the way i want (string, with exactly 137 length) Copy the values from the temp field to the new field Drop the temp field It works perfectly, always. As many shapefiles i want. The problem is i want to run it several times, checking for a lot of fields, in a single run in the tool. If i try to bath it, doesnt work. And if i try to put 'List of Values' in the first parameter 'Multiple Value' it gets error, because model builder doesnt allow both 'model iterator' and 'list of values' working together. Can you guys help me?
... View more
04-19-2017
09:42 AM
|
0
|
2
|
1978
|
POST
|
I figured how to do it. I just need to change it, the way i want one time, than save a .lyr from the correct information (it can also change symbology, and other stuff). The script below, will apply the .lyr file to your layer in the TOC. You just must specify the name of the layer, like displayed in TOC. It will do to all MXD files, in the same folder of the script. import arcpy, os
from arcpy import env
env.workspace = os.curdir
for mxdFile in arcpy.ListFiles("*.mxd"):
mxdPath = env.workspace + "\\" + mxdFile
mxd = arcpy.mapping.MapDocument(mxdPath)
layers = arcpy.mapping.ListLayers(mxd)
for lyr in layers:
if lyr.name == "layer_name_in_TOC": #change here
print mxdPath
symbologyLayer = r"D:\LayerFile.lyr" #change here
arcpy.ApplySymbologyFromLayer_management (lyr, symbologyLayer)
arcpy.RefreshTOC()
mxd.save()
... View more
03-16-2017
06:36 AM
|
2
|
1
|
2968
|
POST
|
I figured how to do it. I just need to change it, the way i want one time, than save a .lyr from the correct information (it can also change symbology, and other stuff). The script below, will apply the .lyr file to your layer in the TOC. You just must specify the name of the layer, like displayed in TOC. It will do to all MXD files, in the same folder of the script. import arcpy, os
from arcpy import env
env.workspace = os.curdir
for mxdFile in arcpy.ListFiles("*.mxd"):
mxdPath = env.workspace + "\\" + mxdFile
mxd = arcpy.mapping.MapDocument(mxdPath)
layers = arcpy.mapping.ListLayers(mxd)
for lyr in layers:
if lyr.name == "layer_name_in_TOC": #change here
print mxdPath
symbologyLayer = r"D:\LayerFile.lyr" #change here
arcpy.ApplySymbologyFromLayer_management (lyr, symbologyLayer)
arcpy.RefreshTOC()
mxd.save()
... View more
03-16-2017
06:34 AM
|
2
|
0
|
502
|
POST
|
Please, try to remember it!!! i really need to change this automatically!!! help me!
... View more
03-15-2017
12:57 PM
|
0
|
0
|
2282
|
POST
|
The problem is, i need to change it in several mxds. More than 1000... And it would make changes in the legend in layout also, because would add 'headings', for example... Thats why i want to try this way!! but thanks for the help...
... View more
03-15-2017
12:49 PM
|
0
|
1
|
2282
|
POST
|
I want to change this information, with python: I have this code (got here: https://community.esri.com/thread/43148 ) , but it changes the layer name. I want to change layer label. It is a simple feature, with no unique values. import arcpy, os
from arcpy import env
env.workspace = os.curdir
for mxdFile in arcpy.ListFiles("*.mxd"):
mxdPath = env.workspace + "\\" + mxdFile
mxd = arcpy.mapping.MapDocument(mxdPath)
layers = arcpy.mapping.ListLayers(mxd)
for lyr in layers:
if lyr.name == "old name":
lyr.name = "newname"
arcpy.RefreshTOC()
mxd.save()
... View more
03-15-2017
12:33 PM
|
0
|
14
|
5178
|
POST
|
Is there a way to change the 'label' of the layerfile? The script above, changes the layer name. But i want to change the layer name. I'm refering to the name is written right after the symbol, in the TOC.
... View more
03-15-2017
12:19 PM
|
0
|
3
|
502
|
POST
|
I put mxd.save() at the end of the script, to ensure keep the changing.
... View more
11-04-2016
09:00 AM
|
0
|
0
|
2797
|
POST
|
The link is not working. Is tere any other place i can get it? Thanks a lot
... View more
02-02-2016
05:15 AM
|
0
|
1
|
1827
|
POST
|
Thanks man! It worked fine! Thanks a lot! How can i know about every code that the python will consider my accents? This is just one case! Is there a dictionay? some examples: á, é, í, ó, ú ã õ â ê ç
... View more
10-08-2015
09:03 AM
|
0
|
2
|
639
|
POST
|
Hi, i have a simple problem and i think there is a simple solution, but i can find or create it. I have a lot of MXD (more than 200) and all of them use a polygon shapefile "study_area_v00.shp". In the data frame, its name is just "Study Area". Every time we change the boundary of the polygon, we save a new copy to "study_area_v01.shp" an so on. All the attributes in table is the same, nothing changes, but the boundary. Every time we open all the mxd and change the data source, one by one because none of pythons i found, work fine. This script works fine, and change all the layerfiles in all MXD in a folder. But there is a little detail in my case: my layer name in table of contents have a word with acccent (Área de Estudo) and the script doesnt recognize it. I translated all the script to all of you understand, but i'm from Brazil and we have a lot of words with accent, and the arcpy doesnt understand it. Can you help me? import arcpy, os
inputPath = os.curdir
outputPath = os.curdir
#layerfile name we want to change, in table of contents
layerfile = "Área de Estudo"
#Folder path of the new shapefile
FolderPath = r"T:\VALE SISTEMA SUL\PDE TREVO\Geoprocessamento\1_Shapefile\Utm"
#Name of the new shapefile, in folder path (without '.shp')
NewShapefile = "AreasEstudo_PDETrevo_v00"
#Loop through each MXD file
for filename in os.listdir(inputPath):
fullpath = os.path.join(inputPath, filename)
if os.path.isfile(fullpath):
if filename.lower().endswith(".mxd"):
mxd = arcpy.mapping.MapDocument(fullpath)
df = arcpy.mapping.ListDataFrames(mxd)[0]
for lyr in arcpy.mapping.ListLayers(mxd, "*", df):
if lyr.name == layerfile:
print layerfile
lyr.replaceDataSource(FolderPath, "SHAPEFILE_WORKSPACE", NewShapefile)
print fullpath
mxd.save() Message was edited by: Dan Patterson
I have taken the liberty to format the post using Syntax highlighting found in the >> option
Hope everything is as you posted.
... View more
10-08-2015
07:31 AM
|
0
|
5
|
3178
|
Title | Kudos | Posted |
---|---|---|
2 | 03-16-2017 06:34 AM | |
4 | 12-21-2012 06:41 PM | |
1 | 08-17-2010 07:06 AM | |
2 | 03-16-2017 06:36 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|