|
POST
|
You will need to create a loop or iteration process to go through each or of your daily records. There are iteration tools in ModelBuilder or maybe export to python and code the iteration/loop process. Regards, Craig
... View more
09-09-2013
03:06 PM
|
0
|
0
|
1268
|
|
POST
|
Have you tried converting pie charts to graphics and then rotating date frame? Regards, Craig
... View more
09-02-2013
03:27 PM
|
0
|
0
|
511
|
|
POST
|
If you have it, Adobe Acrobat can help. I have the same issue with cells with different coloured fills. I usually print to a postscript file and then use Adobe Distiller to make a PDF for hardcopy printing. Regards, Craig
... View more
08-01-2013
04:21 PM
|
0
|
0
|
1446
|
|
POST
|
If you mean autopopulate tree count, could you not use the option within the form design stage under control properties > values and use "auto increment" tick box option? Not sure which version of ArcPad you are on, but I think Python is also an option for ArcPad now as well. Regards, Craig
... View more
07-29-2013
03:03 PM
|
0
|
0
|
398
|
|
POST
|
I tried the tool thinking the point XY would be the same for base and elevation, but even using a base and elevation field, no line feature is created. Not how I would have thought tool would operate. I was thinking it would also create a line using the two height fields, or even one height field if the starting height is 0. Regards, Craig
... View more
07-22-2013
08:34 PM
|
0
|
0
|
1673
|
|
POST
|
'Feature To 3D By Attribute' doesn't seem to work correctly for me. I need to make an output that will be similar to a number of standing poles to intersect with multipatch features. Even though I tried having a base field of 0 and elevation field of 1000, output is points elevated to last field value and not extruded as I would hope or expect. Good suggestion, just not working with point dataset. I would have expected that by setting two height fields I may have been able to replicate the extrude process with this tool for points. Regards, Craig
... View more
07-22-2013
08:18 PM
|
0
|
0
|
1673
|
|
POST
|
I guess I will need to run a two stage process. Run the initial script to make my centroid dataset, manually create my extruded and then 3D features, and then run main script to perform my analysis. Regards, Craig
... View more
07-22-2013
03:48 PM
|
0
|
0
|
1673
|
|
POST
|
Hi All, I am trying to automate a process of converting point centroids, extruding them and then converting them to 3D features. This is a small section in a much larger process, but is it possible using arcpy.mapping to: 1) add the point centroid file (already have calculated a field called "height") - arcpy.mapping.AddLayer 2) extrude point features - the missing link 3) convert to 3D features - 'Layer 3D to feature class". Advice appreciated. Regards, Craig
... View more
07-21-2013
05:26 PM
|
0
|
8
|
2172
|
|
POST
|
Hi All, I have made a custom style by symbolising some data I have and then exported using the 'Export Map Styles' tool. I have added my new style to another map document but only my custom fill patterns are listed. I would like to be able to access the individual colours generated as well that make up the fills. I have done this before but it is not working for me this time. I don't want to manually type in colours again for use with outlines. When I check the custom style, the colours used in the fills are listed under colours. Unsure why this is not working as it should. Regards, Craig
... View more
07-04-2013
09:15 PM
|
0
|
0
|
571
|
|
POST
|
Shaun's advice solved this for me.
import arcpy, sys
import xml.etree.ElementTree as ET
fh = open(r'D:\Temp\CSD_HTML\file.html', 'wb')
html_head = """
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
</head>"""
fh.write(html_head)
XML_List = [r'D:\Temp\test1.xml', r'D:\Temp\test2.xml']
for xml in XML_List:
print xml + '\n'
path = xml
tree = ET.parse(path)
for node in tree.findall('.//title'):
title = node.text
print 'Title: ' + node.text
for node in tree.findall('.//westbc'):
westbc = node.text
print 'West: ' + node.text
for node in tree.findall('.//eastbc'):
eastbc = node.text
print 'East: ' + node.text
for node in tree.findall('.//northbc'):
northbc = node.text
print 'North: ' + node.text
for node in tree.findall('.//southbc'):
southbc = node.text
print 'South: ' + node.text
for node in tree.findall('.//geogunit'):
geogunit = node.text
print 'Geographic Units: ' + node.text
for node in tree.findall('.//horizdn'):
horizdn = node.text
print 'Projection: ' + node.text
for node in tree.findall('.//ellips'):
ellips = node.text
print 'Ellipsoid: ' + node.text
html_body = """
<body>
<p> </p>
<table width="800" border="0">
<tr>
<td width="309" rowspan="5"><img src="Thumbs/img.jpg" alt="" width="300" height="300" align="left"></td>
<td width="4" rowspan="5"> </td>
<td height="50" colspan="3">Title: """ + title + """</td>
</tr>
<tr>
<td width="150" height="50"> </td>
<td width="165" height="50">North: """ + northbc + """</td>
<td width="150" height="50"> </td>
</tr>
<tr>
<td height="50">West: """ + westbc + """</td>
<td height="50"> </td>
<td height="50">East: """ + eastbc + """</td>
</tr>
<tr>
<td height="50"> </td>
<td height="50">South: """ + southbc + """</td>
<td height="50"> </td>
</tr>
<tr>
<td height="150" colspan="3"><p>Geographic Units: """ + geogunit + """</p>
<p>Projection: """ + horizdn + """</p>
<p>Ellipsoid: """ + ellips + """</p></td>
</tr>
</table>
<p> </p>
</body>"""
fh.write(html_body)
html_tail = """
</html>"""
fh.write(html_tail)
fh.close()
del tree
Regards, Craig
... View more
06-25-2013
09:32 PM
|
0
|
0
|
967
|
|
POST
|
Reference above helped me solve my problem. Working code follows:
import arcpy, sys
import xml.etree.ElementTree as ET
XML_List = [r'D:\Temp\file1.xml', r'D:\Temp\file2.xml']
for xml in XML_List:
path = xml
tree = ET.parse(path)
for node in tree.findall('.//title'):
title = node.text
print 'Title: ' + node.text
for node in tree.findall('.//westbc'):
westbc = node.text
print 'West: ' + node.text
for node in tree.findall('.//eastbc'):
eastbc = node.text
print 'East: ' + node.text
for node in tree.findall('.//northbc'):
northbc = node.text
print 'North: ' + node.text
for node in tree.findall('.//southbc'):
southbc = node.text
print 'South: ' + node.text
for node in tree.findall('.//geogunit'):
geogunit = node.text
print 'Geographic Units: ' + node.text
for node in tree.findall('.//horizdn'):
horizdn = node.text
print 'Projection: ' + node.text
for node in tree.findall('.//ellips'):
ellips = node.text
print 'Ellipsoid: ' + node.text
del tree
Regards, Craig
... View more
06-25-2013
08:23 PM
|
2
|
0
|
1583
|
|
POST
|
Hi All, I have a script which pulls information from a number of XML files to populate a table within a HTML document. Although I can pull the information, it is overwriting the table space with the new information. What I would like to do is append the table space (body) of the HTML document for each new XML file, so that I will have a Thumbnail, metadata details for each XML creating a large HTML listing of data for quick reference. import arcpy, sys import xml.etree.ElementTree as ET html_head = """ <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title></title> </head>""" fh = open(r'D:\Temp\CSD_HTML\file.html', 'wb') fh.write(html_head) XML_List = [r'D:\Temp\CSD_HTML\test.xml', r'D:\Temp\CSD_HTML\contours.sdc.xml'] for xml in XML_List: print xml + '\n' path = xml tree = ET.parse(path) for node in tree.findall('.//title'): title = node.text print 'Title: ' + node.text for node in tree.findall('.//westbc'): westbc = node.text print 'West: ' + node.text for node in tree.findall('.//eastbc'): eastbc = node.text print 'East: ' + node.text for node in tree.findall('.//northbc'): northbc = node.text print 'North: ' + node.text for node in tree.findall('.//southbc'): southbc = node.text print 'South: ' + node.text for node in tree.findall('.//geogunit'): geogunit = node.text print 'Geographic Units: ' + node.text for node in tree.findall('.//horizdn'): horizdn = node.text print 'Projection: ' + node.text for node in tree.findall('.//ellips'): ellips = node.text print 'Ellipsoid: ' + node.text html_body = """ <body> <p> </p> <table width="800" border="0"> <tr> <td width="309" rowspan="5"><img src="Thumbs/MitchellD_2013-06-25.jpg" alt="" width="300" height="300" align="left"></td> <td width="4" rowspan="5"> </td> <td height="50" colspan="3">Title: """ + title + """</td> </tr> <tr> <td width="150" height="50"> </td> <td width="165" height="50">North: """ + northbc + """</td> <td width="150" height="50"> </td> </tr> <tr> <td height="50">West: """ + westbc + """</td> <td height="50"> </td> <td height="50">East: """ + eastbc + """</td> </tr> <tr> <td height="50"> </td> <td height="50">South: """ + southbc + """</td> <td height="50"> </td> </tr> <tr> <td height="150" colspan="3"><p>Geographic Units: """ + geogunit + """</p> <p>Projection: """ + horizdn + """</p> <p>Ellipsoid: """ + ellips + """</p></td> </tr> </table> <p> </p> </body>""" fh = open(r'D:\Temp\CSD_HTML\file.html', 'a+') fh.write(html_body) html_tail = """ </html>""" fh = open(r'D:\Temp\CSD_HTML\file.html', 'wb') fh.write(html_tail) fh.close() del tree Having an issue getting subsequent tables to add to HTML with each metadata details for each XML file. Regards, Craig
... View more
06-25-2013
08:20 PM
|
0
|
2
|
1435
|
|
POST
|
Hi All, I have a listing of feature classes and raster datasets that I want to access their metadata for creating a reference spreadsheet and customised html webpage. Metadata elements I would like to access are description, summary, abstract, and extents for starters, and this will change if I determine a different stylesheet. From arcpy / python, how do I access the metadata values to make them into individual variables for manipulation. Regards, Craig
... View more
06-20-2013
08:23 PM
|
0
|
2
|
4318
|
|
POST
|
I adjusted my code to handle both feature classes and raster datasets. Base code provided by jscheirer was invaluable to solving this issue. import arcpy, os, json, traceback, sys, datetime from arcpy import mapping from arcpy import env mxd_out = r'D:\Temp\HTML.mxd' now = datetime.datetime.now() ## Create error log to capture data to further investigate log = r'D:\Temp\CSD_Invertory_' + now.strftime("%Y-%m-%d" + '_' + "%H_%M_%S") + '_Error.log' if arcpy.Exists(log): arcpy.Delete_management(log) if arcpy.Exists(mxd_out): arcpy.Delete_management(mxd_out) ## Create a dummy blank mxd to utilise mapService = {} jsonDump = json.dumps(mapService) result = mapping.ConvertWebMapToMapDocument(jsonDump) mxd = result.mapDocument my_mxd = mxd.saveACopy(mxd_out) env.workspace = r"D:\Temp\SpatialData" contents = [] for dirpath, dirnames, datatypes in arcpy.da.Walk(env.workspace): contents.append(os.path.join(dirpath)) for item in contents: if arcpy.Exists(item): arcpy.env.workspace = item listType = [arcpy.ListFeatureClasses, arcpy.ListDatasets] for list in listType: datasetList = list("*", 'All') # Iterate over the feature classes for dataset in datasetList: data = item + '\\' + dataset desc = arcpy.Describe(data) print data + ' : ' + desc.dataType # Crack open the map mxd_new = arcpy.mapping.MapDocument(mxd_out) df = arcpy.mapping.ListDataFrames(mxd_new, '*')[0] try: lyrFile = arcpy.mapping.Layer(data) if desc.dataType == 'RasterDataset': layerType = arcpy.management.MakeRasterLayer result = layerType(lyrFile, 'temp_layer') layer_object = result.getOutput(0) arcpy.mapping.AddLayer(df, layer_object) else: result = arcpy.management.MakeFeatureLayer(lyrFile, 'temp_layer') layer_object = result.getOutput(0) arcpy.mapping.AddLayer(df, layer_object) # Set correct extent df.zoomToSelectedFeatures() nm = os.path.splitext(dataset)[0] # Compute an output file name out_file_name = (r"D:\Temp\Thumbnails" + "\\" + nm + '.jpg') # Export "thumbnail" of data frame arcpy.mapping.ExportToJPEG(mxd_new, out_file_name, df, 300, 300) # Pull the layer out of the data frame to make room for the next one arcpy.mapping.RemoveLayer(df, layer_object) # Delete the GP layer arcpy.management.Delete('temp_layer') except: arcpy.ExecuteError arcpy.AddError(arcpy.GetMessage(2)) f=open(log, 'at') f.write(data + '\n') f.close() del mxd, mxd_new if arcpy.Exists(mxd_out): arcpy.Delete_management(mxd_out) del mxd_out I am making thumbnails at this point for incorporation into metadata pages for exporting to HTML pages (see http://forums.arcgis.com/threads/86942-XSLT-Transformation-Thumbnails for next point of contention). Regards, Craig
... View more
06-18-2013
09:30 PM
|
0
|
0
|
1819
|
|
POST
|
Hi All, I have two issues. I am running ArcGIS 10.1 Windows 7 64 bit (those are not the issues - hopefully). 1) I am trying to use the XSLT Transformation Conversion but outside of ArcGIS Python window it does not run. IDLE / PyScripter just hang at this section of code. Same code runs fine within the python window of ArcGIS 10.1; 2) I have a number of thumbnails that I have created that I would like to utilise in the the created HTML pages produced by a functioning XSLT Transformation Conversion, but don't know how to get them into the output HTML. I believe the thumbnails need to be incorporated at some point into metadata files for my datasets, so I guess I am missing a section of code relating to editing metadata. Following is my code:
##
## 1) Create a blank MXD
## 2) Loop through data and add to MXD to export Thumbnails
## 3) Create HTML metadata pages incorporating Thumbnails
##
import arcpy, os, json, traceback, sys, datetime
from arcpy import mapping
from arcpy import env
mxd_out = r'D:\Temp\HTML.mxd'
now = datetime.datetime.now()
log = r'D:\Temp\CSD_HTML\Invertory_' + now.strftime("%Y-%m-%d" + '_' + "%H_%M_%S") + '_Error.log'
if arcpy.Exists(log):
arcpy.Delete_management(log)
if arcpy.Exists(mxd_out):
arcpy.Delete_management(mxd_out)
mapService = {}
jsonDump = json.dumps(mapService)
result = mapping.ConvertWebMapToMapDocument(jsonDump)
mxd = result.mapDocument
my_mxd = mxd.saveACopy(mxd_out)
env.workspace = r"D:\Temp\Data"
contents = []
print 'Starting'
for dirpath, dirnames, datatypes in arcpy.da.Walk(env.workspace):
contents.append(os.path.join(dirpath))
for item in contents:
if arcpy.Exists(item):
arcpy.env.workspace = item
listType = [arcpy.ListFeatureClasses, arcpy.ListDatasets]
for list in listType:
datasetList = list("*", 'All')
# Iterate over the feature classes
for dataset in datasetList:
data = item + '\\' + dataset
desc = arcpy.Describe(data)
print data + ' : ' + desc.dataType
# Crack open the map
mxd_new = arcpy.mapping.MapDocument(mxd_out)
df = arcpy.mapping.ListDataFrames(mxd_new, '*')[0]
try:
lyrFile = arcpy.mapping.Layer(data)
if desc.dataType == 'RasterDataset':
layerType = arcpy.management.MakeRasterLayer
result = layerType(lyrFile, 'temp_layer')
layer_object = result.getOutput(0)
arcpy.mapping.AddLayer(df, layer_object)
else:
result = arcpy.management.MakeFeatureLayer(lyrFile, 'temp_layer')
layer_object = result.getOutput(0)
arcpy.mapping.AddLayer(df, layer_object)
# Set correct extent
df.zoomToSelectedFeatures()
nm = os.path.splitext(dataset)[0]
# Compute an output file name
out_file_name = (r"D:\Temp\Thumbs" + "\\" + nm + '.jpg')
# Export "thumbnail" of data frame
arcpy.mapping.ExportToJPEG(mxd_new, out_file_name, df, 300, 300)
# Pull the layer out of the data frame to make room for the next one
arcpy.mapping.RemoveLayer(df, layer_object)
# Delete the GP layer
arcpy.management.Delete('temp_layer')
#set local variables
dir = arcpy.GetInstallInfo("desktop")["InstallDir"]
xslt = dir + "Metadata/Stylesheets/ArcGIS.xsl"
arcpy.XSLTransform_conversion(data, xslt, r'D:\Temp' + '\\' + nm + '.html', out_file_name)
## xslt = r"C:\Program Files (x86)\ArcGIS\Desktop10.1\Metadata\Stylesheets\ArcGIS.xsl"
## arcpy.XSLTransform_conversion(data, xslt, r'D:\Temp' + '\\' + nm + '.html', out_file_name)
except:
arcpy.ExecuteError
arcpy.AddError(arcpy.GetMessage(2))
f=open(log, 'at')
f.write(data + '\n')
f.close()
del mxd, mxd_new
if arcpy.Exists(mxd_out):
arcpy.Delete_management(mxd_out)
del mxd_out
Guidance greatly appreciated. Regards, Craig
... View more
06-18-2013
09:17 PM
|
0
|
2
|
2787
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-22-2014 03:26 PM | |
| 1 | 11-03-2022 03:28 PM | |
| 1 | 05-24-2021 05:01 PM | |
| 1 | 12-02-2019 02:46 PM | |
| 2 | 11-01-2020 07:20 PM |
| Online Status |
Offline
|
| Date Last Visited |
06-04-2025
09:55 PM
|