|
POST
|
Hi guys, I have this ddp with a ground elevation grid with a stretched symbology. When I try to do some test exports, not all page comes out right with the imagery. Sometimes the grid is all red or all blue. I have some snapshots below of good (left) and bad (right) result of the ddp exporting, Aside from the stretched symbology, I have further settings for my raster as below, So basically, my raster value max-min range change for each visible in the current page extent. And I apply the same dynamic behaviour to my raster legend entry. Now the issue is I cannot seems to make them export correctly if by batch, it works for single export. Is there a limitation on the ddp exports if dealing with rasters setup the way I did. Regards, Chris
... View more
12-10-2014
06:48 PM
|
0
|
1
|
2316
|
|
POST
|
sorry I wasn't clear. the extents parameter in my function is an actual list of all the returned rows from your main, so means the function requires you to create a list of all those extent objects.
def GetExtents(extents):
XMin = min([ext.XMin for ext in extents])
XMax = max([ext.XMax for ext in extents])
YMin = min([ext.YMin for ext in extents])
YMax = max([ext.YMax for ext in extents])
return arcpy.Extents(XMin, YMin, XMax, YMax)
extents = []
with arcpy.da.SearchCursor(lyr, field, query) as cur:
for row in cur:
extents.append(row[0].extent)
if len(extents) == 0:
do something
elif len(extents) == 1:
do something
elif len(extents) >1:
df.extent = GetExtents(extents)
... View more
10-23-2014
12:33 PM
|
0
|
3
|
3606
|
|
POST
|
just create a function within your script, def GetExtents(extents): XMin = min([ext.XMin for ext in extents]) XMax = max([ext.XMax for ext in extents]) YMin = min([ext.YMin for ext in extents]) YMax = max([ext.YMax for ext in extents]) return arcpy.Extents(XMin, YMin, XMax, YMax) and within your main for the qualifying condition, df.extent = GetExtents(extents)
... View more
10-23-2014
12:00 PM
|
1
|
0
|
3606
|
|
POST
|
row count = len(list(i for i in arcpy.da.SearchCursor(fc, fields, query)))
... View more
10-23-2014
10:33 AM
|
5
|
1
|
3716
|
|
POST
|
I agree Carl, I've been looking for other ways before actually, some lead to doing something with ArcObjects rather than python. But just for a stop-gap solution, and just utilising what already exist, this might suffice. You might also just create a batch command file as well and run as a schedule task. Although I read MXD doctor does a similar job in reducing file size as well. Regards,
... View more
09-01-2014
03:17 PM
|
0
|
0
|
2106
|
|
POST
|
I tried this, import subprocess subprocess.call(['C:\Program Files (x86)\ArcGIS\Desktop10.2\Tools\DocDefragmenter.exe', r'sourcefilepath', r'targetfilepath']) Regards,
... View more
08-31-2014
06:46 PM
|
3
|
2
|
2106
|
|
POST
|
I think you can easily get the target and join layers like this,
inputLayer = r"...\testLayer.lyr"
targetLayerName = (arcpy.mapping.Layer(inputLayer)).name
fields = arcpy.ListFields(inputLayer)
lyrList = []
for item in fields:
if ((item.name).split('.'))[0] not in lyrList:
lyrList.append(((item.name).split('.'))[0])
for lyr in lyrList:
if lyr != targetLayerName:
print 'Join Layer: '+lyr
As for finding the join ID and type, no clue as well. Cheers
... View more
07-02-2014
05:44 PM
|
0
|
0
|
405
|
|
POST
|
You need to go into python window, access the layer property name and use your inputs like,
for lyr in lyrs:
if lyr.name == 'SITE Buffer':
lyr.name = 'SITE\r\nBuffer'
For me "SITE\r\nBuffer" displays as "SITE\r\nBuffer"...what am I missing? I've changed it in the symbology label area, in the label appearing next to symbol, and in the layer name on the general tab? Thanks, Susan
... View more
06-09-2014
04:00 PM
|
0
|
0
|
2117
|
|
POST
|
I think what you can do since you have a one is to many relationship, to join it properly follow the link below, http://resources.arcgis.com/en/help/main/10.1/index.html#//0017000000v9000000 Regards, Thanos
... View more
05-08-2014
07:33 PM
|
0
|
0
|
411
|
|
POST
|
Here is a sample code for the field calculator:
def mean(field1, field2, field3):
fieldList = [field1, field2, field3]
validList = []
for i in fieldList:
if i != None:
validList.append(i)
meanVal = sum(validList)/len(validList)
return meanVal
Hi Xavier! I think importing numpy for this case is a bit of a stretch since youll have to load numpy everytime you iterate thru the rows. Hows Davao by the way or are you in Manila? regards, Chris P.
... View more
04-23-2014
07:55 PM
|
0
|
0
|
1874
|
|
POST
|
I got this result,
for i in arcpy.da.SearchCursor("Ngaruawahia_StructurePlanAreas", ['SHAPE@', 'SHAPE@XY', 'SHAPE@TRUECENTROID']):
... print (i[0].centroid.X,i[0].centroid.Y), i[1], i[2]
...
(1789821.778531158, 5820949.009319027) (1789821.778531158, 5820949.009319027) (1789821.778531158, 5820949.009319027)
(1782710.746833228, 5828120.099465807) (1782710.746833228, 5828120.099465807) (1782710.746833228, 5828120.099465807)
(1793174.7978348304, 5834627.9375800025) (1793174.7978348304, 5834627.9375800025) (1793174.7978348304, 5834627.9375800025)
(1793743.185461287, 5824684.673387148) (1793743.185461287, 5824684.673387148) (1793743.185461287, 5824684.673387148)
(1790026.8500248736, 5828569.732378332) (1790026.8500248736, 5828569.732378332) (1790026.8500248736, 5828569.732378332)
(1791073.8189072697, 5832543.665935521) (1791073.8189072697, 5832543.665935521) (1791073.8189072697, 5832543.665935521)
(1772783.6783350855, 5873593.864663156) (1772783.6783350855, 5873593.864663156) (1772783.6783350855, 5873593.864663156)
Seems fine.
... View more
04-23-2014
05:11 PM
|
0
|
2
|
2874
|
|
POST
|
Did you use the correct inputs for that export function? This small bit works actually,
if mxd.isDDPEnabled:
ddp = mxd.dataDrivenPages
ddp.exportToPDF(r'E:\test.pdf','ALL')
I have sample export code I did for my mxd's that are mixed DDP and normal ones:
for mxdDoc in mapList:
mxd = arcpy.mapping.MapDocument(mxdDoc)
base = os.path.splitext(os.path.basename(mxdDoc))[0]
print 'Checking if DDP'
if mxd.isDDPEnabled == False:
pdfName = os.path.join(outPath, base +'.pdf')
arcpy.mapping.ExportToPDF(mxd, pdfName, '', resolution=300, image_compression='ADAPTIVE', layers_attributes='NONE', image_quality='BEST')
else:
if mxd.dataDrivenPages.pageCount <= 3:
for pageName in pageNames:
mxd.dataDrivenPages.refresh()
pageID = mxd.dataDrivenPages.getPageIDFromName(pageName)
mxd.dataDrivenPages.currentPageID = pageID
pdfName = os.path.join(outPath, base +'_'+str(pageName)+'.pdf')
mxd.dataDrivenPages.exportToPDF(pdfName, 'CURRENT', '', 'PDF_SINGLE_FILE', 300, 'BEST', 'RGB',True, 'ADAPTIVE', 'RASTERIZE_PICTURE', False, True)
del mxdDoc, mapList
del mxd
Also you don't need to do "for" statement to get your text element since there is a wildcard. Just try,
x = arcpy.mapping.ListLayoutElements(mxd, TextElement, 'wildcard')[0]
... View more
02-06-2014
05:17 PM
|
0
|
0
|
1617
|
|
POST
|
try ddp.exportToPDF Hi, I'm new to Python and trying to write a script that will do the following: 1. Loop through all mxd's in a folder and edit a Text Element named "SubTitle" 2. Save the mxd 3. Export each mxd to pdf The problem is there are some mxd's with Data Driven Pages enabled, so I can't get the script to export ALL pages of a multi-page map. I wrote an "if-else" so that I can distinguish the multi-page maps from the single page maps. Everything else works fine except for the ddp map. The error msg I get: ddp.ExportToPDF(mxd, basename, "ALL") AttributeError: 'DataDrivenPages' object has no attribute 'ExportToPDF' See attached screenshot of the code. [ATTACH=CONFIG]31200[/ATTACH]
... View more
02-06-2014
02:22 PM
|
0
|
0
|
1617
|
|
POST
|
Hi buddy, Just look thru this documentation to have a feel for what you want to do, http://resources.arcgis.com/en/help/main/10.1/index.html#//00170000004m000000 Cheers Okay, thanks for that input, Thanos. I have decided that an actual script within a toolbox is the route that I am going to go. I have this worked out so far: import arcpy
# Set the input workspace
#
arcpy.env.workspace = arcpy.GetParameterAsText(0)
# Set the output workspace
#
outWorkspace = arcpy.GetParameterAsText(1)
try:
# Get a list of the featureclasses in the input folder
#
fcs = arcpy.ListFeatureClasses()
for fc in fcs:
# Validate the new feature class name for the output workspace.
#
featureClassName = arcpy.ValidateTableName(fc, outWorkspace)
outFeatureClass = os.path.join(outWorkspace, featureClassName)
def Reclass(symbol):
if MTFCC == "H3010":
return "River"
elif MTFCC == "H1100":
return "Creek"
except:
arcpy.AddMessage(arcpy.GetMessages(2))
print arcpy.GetMessages(2) Basically I am to the point where I tell it what to do and I'm not really sure how to do so.
... View more
10-24-2013
01:50 PM
|
0
|
0
|
782
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-23-2014 12:00 PM | |
| 1 | 01-23-2013 05:05 PM | |
| 1 | 02-13-2018 05:55 PM | |
| 1 | 07-04-2017 02:01 PM | |
| 1 | 08-02-2017 01:57 AM |