POST
|
Hi folks, Rebecca - Yeah I made all though checks and they were ok. Bill - your solution worked perfectly until I had an mxd that had more than one database connection in there e.g: DARDOFMD@lpisapp.sde & DARDOFMD@suppapp.sde. So I get an mxd with only some of the layers replaced and others with broken links! So close...
... View more
05-28-2015
09:38 AM
|
0
|
0
|
673
|
POST
|
Hi all, I have created a python script that lists all the mxds within a folder directory and then replaces the workspace paths. Now it works correctly for the majority of mxds but on a couple of the mxds it is failing to to replace the workspace path. I would appreciate any advice. I have copied the code into this question but also attached the code. Please note I have more than 1 database connection hence why there is the two find and replace lines for the two connections. Thanks # ##Lists all MXDs within a folder and replaces the SDE connection for fileName in os.listdir(path): fullPath = os.path.join(path, fileName) if os.path.isfile(fullPath): basename, extension = os.path.splitext(fullPath) if extension.lower() == ".mxd": mxd = arcpy.mapping.MapDocument(fullPath) mxd.findAndReplaceWorkspacePaths(devconn1, conn1) mxd.findAndReplaceWorkspacePaths(devconn2, conn2) mxd.saveACopy(os.path.join(output, fileName)) del mxd
... View more
05-28-2015
07:49 AM
|
0
|
3
|
3457
|
POST
|
Hi all, We have developed that a python script that will allow us to search a FGDb however once we put it onto the server and use it against a Query Feature Class (a view containing a query from several tables) then it fails as it doesnt like the data source. When we hard coded the connection path it states that the expression is empty!!! Please find the code below, any ideas on a SearchCursor within arcpy that can search a query layer?? Like I said, we know the code works it's just this one thing that is failing on the new environment cursor = arcpy.SearchCursor(fieldsLyr.dataSource, where_clause=ddp_field + " = '" + busid + "'", fields="MIA_BY_CATEGORY") Any help is always appreciated, Thanks
... View more
08-13-2014
06:35 AM
|
0
|
2
|
1399
|
POST
|
Hi I have managed to generate a query table from a few data sources and now I need to export that table to be printed in PDF format. There are a large number of these tables to be generated, all unique, and I have managed to even sort that part (not bad considering my inexperience with python), however I need to be able to create a template so when i export every query it will be exported in the standard layout I need it to be. Any help would be appreciated,I have loaded a copy of the model I am using to export the Table View of the Query Table to dbf. Thanks in advance John
... View more
07-09-2014
02:34 AM
|
0
|
0
|
509
|
POST
|
Hi all, I have been trying to find a way to automate the exporting of pdf from DDP. Which i have managed to achieve, through a lot of the posts and scripts on this forum, so thanks for that. I am now trying to automate the selection of only a couple or one of the attributes so the end user can select one value and print that particular PDF rather than all the records (which is alot!) I have attached my code,(only learning so please be kind but honest!!) a screen shot of the kind of output I am trying to achieve. Any advice is welcome. Thanks in advance
... View more
06-30-2014
06:48 AM
|
0
|
1
|
2451
|
POST
|
Hi Dan, I am going to have a play with your advice now. Essentially my problems are (many but will simplify) 1. I need to create datadriven pages from a specific query, which I have managed to do at the minute. 2. The results of this query needs to be also shown in a seperate table hence why I am trying to export it to Excel. We have had a look at using Production mapping but there are too many varied results between queries to maintain a consistent look. 3. I am unsure, due to my inexperience if I should be changing the input and out when it appears in the script to get the results. Hope that makes sense and thanks for your help
... View more
06-19-2014
07:11 AM
|
0
|
0
|
859
|
POST
|
This a view of the amended code, as per your advice import arcpy import os import sys import xlwt import datetime mxd=arcpy.mapping.MapDocument("current") BUSID_TEMP=arcpy.GetParameterAsText(0) LayersDF=arcpy.mapping.ListDataFrames(mxd, "Layers")[0] selLyr=arcpy.mapping.ListLayers(mxd, "FP_sample", LayersDF)[0] for elm in arcpy.mapping.ListLayoutElements(mxd): if elm.name=="GridTable": GridTable = elm ddp=mxd.dataDrivenPages arcpy.AddMessage(BUSID_TEMP) pageID=mxd.dataDrivenPages.getPageIDFromName(str(BUSID_TEMP)) mxd.dataDrivenPages.currentPageID=pageID #excel export part of the script def table_to_excel(FP_sample, output, use_field_alias=False, use_domain_desc=False): desiredFields=["Field1","Field3","Field4"] #desired fields for excel output # Get the fields from the input fields= arcpy.ListFields(in_table) # Create a fieldinfo object fieldinfo = arcpy.FieldInfo() # Iterate through the fields and set them to fieldinfo for field in fields: if field in desiredFields: fieldinfo.addField(field.name, field.name, "VISIBLE", "") # The created view layer will have fields as set in fieldinfo object arcpy.MakeTableView_management(FP_sample, "table_view", "", "", fieldinfo) # To persist the layer on disk make a copy of the view arcpy.TableToExcel_conversion("table_view", pop.xls)
... View more
06-19-2014
12:37 AM
|
0
|
0
|
859
|
POST
|
It seems to work, unfortunately I don't know how to define the output
... View more
06-18-2014
11:57 PM
|
0
|
0
|
859
|
POST
|
Hi Joshua, Thanks for replying, that certainly looks promising. I am actually trying to export the table based on a query I have already ran and linked to Data Driven Pages. How would I refernce that in the Make Table View? I am new to this so please excuse the silly question. I have linked my current attempt at the script, which works for the initial part of what I am trying to achieve, just failing at the output. I have attached my script so you can maybe see it easier. Thanks
... View more
06-18-2014
08:07 AM
|
0
|
0
|
859
|
POST
|
Hi, I am currently trying to use the Table to Excel script to produce a table of a query that I have created. It returns all the fields not just the selected one. Any ideas? I am sure it is simple Thanks John
... View more
06-18-2014
07:38 AM
|
0
|
8
|
1204
|
POST
|
Thanks Dan, silly error. I am struggling to get the script to run and the problem seems to lay in my query and Search Cursor. It is giving me an error which says Traceback (most recent call last): File "D:\Profiles\jByrne\Documents\DARD GIS\TEST SCRIPT\GridMon16_help.py", line 13, in <module> FP_sampleRows=arcpy.SearchCursor(GridTable.datasource, queryExp) AttributeError: 'TextElement' object has no attribute 'datasource' I have attached my code as well. I am running out of ideas and because I don't know it very well (started scripting friday!) I can't really see the wood for the trees. import arcpy, os, sys mxd=arcpy.mapping.MapDocument("current") BUSID_TEMP=arcpy.GetParameterAsText(0) LayersDF=arcpy.mapping.ListDataFrames(mxd, "Layers")[0] selLyr=arcpy.mapping.ListLayers(mxd, "FP_sample", LayersDF)[0] for elm in arcpy.mapping.ListLayoutElements(mxd): if elm.name=="GridTable": GridTable = elm ddp=mxd.dataDrivenPages arcpy.AddMessage(BUSID_TEMP) pageID=mxd.dataDrivenPages.getPageIDFromName(str(BUSID_TEMP)) mxd.dataDrivenPages.currentPageID=pageID queryExp="\"BUSID_TEMP\"='"+BUSID_TEMP+"'" FP_sampleRows=arcpy.SearchCursor(GridTable.datasource, queryExp) revTable=arcpy.mapping.ListTableViews(mxd,"GridTable") arcpy.RefreshActiveView() arcpy.AddMessage("Process Completed") Thanks
... View more
06-16-2014
05:09 AM
|
0
|
1
|
961
|
POST
|
Morning all, I am trying to put together a script that automatically updates the active table in Data Driven Pages. I found the script from one of the user groups on here and I think I have managed to alter the script but there is showing an error in line 39 and line 40 arcpy.RefreshActiveView() arcpy.AddMessage("Process Completed") Not sure what to do to fix this as I am only learning python and scripting. I have attached a jpeg of the code in case it helps, Many thanks
... View more
06-16-2014
12:26 AM
|
0
|
3
|
1481
|
POST
|
Hi all. I am sure this has been answered and I have downloaded a sample set already but my knowledge on editing Python script is poor. I am trying to update a table in my DDP to reflect a query that I am running, in this event its a BUSID_TEMP field and display the result in the map layout. I have managed to get all the processes to work apart from automatically updating/producing the table. So I guess my question is how to i automate the table to reflect what is being displayed in my DDP
... View more
06-13-2014
05:35 AM
|
0
|
0
|
723
|
POST
|
Hi Jeff, I am a newbie to DynamicGraphicTables and Data Driven pages. Your links were really useful and seem to be exactly what I want to do, unfortunately I am not a guru on python and am struggling to edit the python script to use it for my own needs. Any advice? Thanks John
... View more
06-13-2014
03:00 AM
|
0
|
0
|
1653
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|