Mercurial > mxd2map
comparison contrib/python/generateHTML.py @ 216:d0acdab62b03
imported patch arcpy-erweiterung
author | Stephan Holl <stephan.holl@intevation.de> |
---|---|
date | Mon, 25 Jul 2011 10:51:39 +0200 |
parents | 0c58db91311c |
children | 13f1cf17f620 |
comparison
equal
deleted
inserted
replaced
208:0c58db91311c | 216:d0acdab62b03 |
---|---|
58 gm += '&bbox='+''.join(ext) | 58 gm += '&bbox='+''.join(ext) |
59 print "<li><a target='_new' href='%s'>%s</a> | <a target='_new' href='%s'>WMS GetMap</a></li>" % (urlmapfile, layers[i], gm) | 59 print "<li><a target='_new' href='%s'>%s</a> | <a target='_new' href='%s'>WMS GetMap</a></li>" % (urlmapfile, layers[i], gm) |
60 i=i+1 | 60 i=i+1 |
61 print "</ul>" | 61 print "</ul>" |
62 | 62 |
63 def generateArcImage(mapfile): | |
64 basename = os.path.basename(mapfile) | |
65 mxdfile = mapfile.replace(".map",".mxd") | |
66 output = mapfile.replace(".map", "_arcpy.png") | |
67 if debug: | |
68 print "MXDfile: %s\nOutput: %s " % (mxdfile, output) | |
69 | |
70 if not output: | |
71 import arcpy | |
72 mxd = arcpy.mapping.MapDocument(mxdfile) | |
73 df = arcpy.mapping.ListDataFrames(mxd)[0] | |
74 arcpy.mapping.ExportToPNG(mxd, output, df, df_export_width=800, | |
75 df_export_height=600, world_file=True) | |
76 del mxd | |
77 | |
78 | |
63 def writeGroups(mapfile,groups): | 79 def writeGroups(mapfile,groups): |
64 if len(groups) > 1: | 80 if len(groups) > 1: |
65 print "Anzahl der Gruppen: %s" % len(groups) | 81 print "Anzahl der Gruppen: %s" % len(groups) |
66 i = 0 | 82 i = 0 |
67 print "<ul>" | 83 print "<ul>" |
101 groups.append(gr) | 117 groups.append(gr) |
102 if "EXTENT" in line: | 118 if "EXTENT" in line: |
103 ext = line[9:].replace('"','').replace(' ', ',') | 119 ext = line[9:].replace('"','').replace(' ', ',') |
104 extent.append(ext) | 120 extent.append(ext) |
105 | 121 |
122 generateArcImage(f) | |
106 print "<ul>" | 123 print "<ul>" |
107 writeLayers(f, layers, extent) | 124 writeLayers(f, layers, extent) |
108 print "</ul>" | 125 print "</ul>" |
109 | 126 |
110 # write groups | 127 # write groups |