|
POST
|
I don't think the named user thing is causing the problem at this point, but I am not sure If your task is running with a different account than yours, then it will likely fail whenever you are referencing a path with your credentials in it like you've got now, r'C:\Users\rbasaria\AppData\Roaming\ESRI
... View more
04-16-2018
10:30 AM
|
0
|
1
|
2262
|
|
POST
|
The vwfcin looks like it's being set to a named user directory? If this is not related to the current problem you are experiencing, my guess is that it will be a problem later on if setting this to run as a scheduled task. Also, is "Exterior_Electrical" a Feature Dataset in the gdb? You may have to go ahead and re-work those path references using os.path.join() You may want to just eliminate anything like this for now and simply hardcode the value. gdfc = gdfcin.split('\\')[-1]
... View more
04-16-2018
10:01 AM
|
0
|
4
|
3478
|
|
POST
|
Flip the search around and iterate the list of raster names and paths to evaluate, use os.path.basename to strip the raster name from the full path name. Probably a much more elegant way to go about it. #replicate a list of raster names
raslist = ['E:\blah\blah\mygdb.gdb\TDSDiff_y2013m288_y2013m12_111','E:\blah\blah\mygdb.gdb\TDSDiff_y2013m288_y2013m218_111','E:\blah\blah\mygdb.gdb\TDSDiff_y2040m218_y2013m218_111']
#specify the workspace where the rasters are located
ws = r'H:\RasterExport\ras.gdb'
arcpy.env.workspace = ws
#set a list of rasters in that workspace
rasters = arcpy.ListRasters('*')
#iterate the list of rasters and evaluate whether or not the 3 rasters in the list exist in the workspace
for rasternameAndPath in raslist:
rasterName = os.path.basename(rasternameAndPath)
if rasterName in rasters:
print rasterName
... View more
04-05-2018
11:25 AM
|
1
|
2
|
3731
|
|
POST
|
#replicate a list of raster names
raslist = ['TDSDiff_y2013m288_y2013m12_111','TDSDiff_y2013m288_y2013m218_111','TDSDiff_y2040m218_y2013m218_111']
#specify the workspace where the rasters are located
#in my test, this workspace contains 6 rasters in total includes 3 in replicated list above
ws = r'H:\ras.gdb'
arcpy.env.workspace = ws
#set a list of rasters in that workspace
rasters = arcpy.ListRasters('*')
#iterate the list of rasters and evaluate whether or not the 3 rasters in the list exist in the workspace
for raster in rasters:
if raster in raslist:
print raster
... View more
04-05-2018
10:25 AM
|
1
|
6
|
3731
|
|
POST
|
http://pro.arcgis.com/en/pro-app/arcpy/functions/listfeatureclasses.htm arcpy.env.workspace = <workspace>
fcs = arcpy.ListFeatureClasses('*')
for fc in fcs:
test = int(arcpy.GetCount_management(fc).getOutput(0))
print 'Feature Count: {}'.format(test)
if test > 0:
print 'Deleting Feature Class: {}'.format(fc)
arcpy.Delete_management(fc)
... View more
04-03-2018
06:51 AM
|
1
|
0
|
2008
|
|
POST
|
What do you want to do if a duplicate PREM_ID is found?
... View more
04-02-2018
01:44 PM
|
0
|
1
|
1462
|
|
POST
|
From what I recall, I don't believe there is an option to select a .kmz file.
... View more
04-02-2018
11:49 AM
|
0
|
3
|
2705
|
|
POST
|
Very unrefined, but likely somewhat close to what you want it to do: import arcpy
targetFC = r'C:\Users\j\Documents\ArcGIS\Default.gdb\MyFeatures2'
sourceFC = r'C:\Users\j\Documents\ArcGIS\Default.gdb\MyFeatures'
with arcpy.da.SearchCursor(sourceFC, ['SHAPE@', 'Values1']) as scur:
for srow in scur:
vals1 = srow[1].split(':')
vals2 = vals1[1].split(',')
for value in vals2:
print value
with arcpy.da.InsertCursor(targetFC, ['SHAPE@', 'Values1']) as icur:
icur.insertRow((srow[0], value))
del icur
... View more
03-29-2018
01:18 PM
|
2
|
0
|
5455
|
|
POST
|
val = '(3: 79, 279, 4729)'
vals1 = val.split(':')
vals2 = vals1[1].split(',')
for v in vals2:
print v
#perhaps setup an InsertCursor to copy the SHAPE, insert the line feature and set the desired attribute to v Not a solution, and not very elegant, but just one way to break out the three attribute values you will need.
... View more
03-29-2018
12:47 PM
|
1
|
0
|
5455
|
|
POST
|
The solution is that there is no straight forward way to implement this. To complicate things, I've been tasked to replicate the reporting capabilities found on the Survey123 site, which allows users to upload a word doc template with merge fields setup to map to the fields in the hosted feature service source data. Implementing this with python is just messy. However I was able to coble it all together and just have the source script, word document template and run this on a timed schedule from a batch scripting server we have. The download feature service is an adaptation of Jake Skinner's script https://community.esri.com/docs/DOC-6496-download-arcgis-online-feature-service-or-arcgis-server-featuremap-service The rest of the implementation simply takes the output of that download, takes the attachments table and transposes those rows into columns. Those values just point to the directory where the images were downloaded to and a final csv is generated that is used as the datasource to the word document template with the mail merge all setup. The last step just uses win32com.client to perform the merge operation and save each document out to a pdf output that is saved in a desired network directory that the customer has specified. Like I said, messy. But doable. As with a lot of things I've been asked to implement, the challenge is with non-arcpy operations. With this one it was figuring out simply how to insert images into the template mail merge document and force sizing.
... View more
03-19-2018
11:33 AM
|
1
|
0
|
4817
|
|
POST
|
I can insert the images into the template .docx file, that's solved. The issue is finalizing a comprehensive data source for that docx to hook the merge fields. It's challenging because the attachment table is related to the feature class and these must be processed into a single data source as a final output that the doc can use.
... View more
03-13-2018
10:34 AM
|
0
|
1
|
4817
|
|
POST
|
I had thought about the Personal GDB but not sure if I can go there. I've actually made some progress, the challenge as usual is not necessarily arcpy related but is in re-working an intermediate output data source that contains merged rows of the attachments with the feature class and dumping all of the attachments into a single directory that you can map the rows to. From there it's a matter of building the merge fields (which is actually sort of tricky) to use the directory path + image names that are mapped to each row in the intermediate output. It will look something like this, {INCLUDEPICTURE "{IF TRUE "{Mergefield <<column in source data>>}" } " \d" Once the datasource process is figured out and the source MS Word doc is setup, it's just a matter of implementing win32com.client to run the merge. app = win32com.client.Dispatch("Word.Application")
doc = app.Documents.Open(doc_template_name)
doc_template = app.Documents.Open(doc_template_name)
... View more
03-13-2018
08:28 AM
|
0
|
0
|
4817
|
|
POST
|
Any examples for using a FGDB feature class as the data source for a MS Word Document mail merge? I'm able to implement this by simply exporting the feature class as csv but I need to extend this to include a FGDB containing attachments and be able to add the images into the word document as well. Thanks for any ideas.
... View more
03-12-2018
12:03 PM
|
0
|
9
|
5342
|
|
POST
|
Just a quick guess. query_result1 = feature_layer.query(where="recordCulvertCorrect='no'", out_fields='objectid,globalid,Date_,CulvertName,pullCulvertMaterial,pullCulvertDiameter')
... View more
03-02-2018
11:06 AM
|
1
|
0
|
3227
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-17-2020 10:47 AM | |
| 1 | 10-25-2022 11:46 AM | |
| 1 | 08-08-2022 01:40 PM | |
| 1 | 02-15-2019 08:21 AM | |
| 2 | 08-14-2023 07:14 AM |
| Online Status |
Offline
|
| Date Last Visited |
01-22-2025
02:28 PM
|