-
Notifications
You must be signed in to change notification settings - Fork 7
/
XMLWriter.py
104 lines (76 loc) · 1.68 KB
/
XMLWriter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
'''
Created on 26.03.2014
@author: tobi
'''
url = ""
originX = -20037508.342787
originY = 20037508.342787
anzZooms = 18
latestwkid = 900913
blockX = 256
blockY = 256
def writeFile():
text = '''<GDAL_WMS>
<Service name="TMS">
<ServerUrl>'''
text += str(url)
text += '''</ServerUrl>
</Service>
<DataWindow>
<UpperLeftX>'''
text += str(originX)
text += '''</UpperLeftX>
<UpperLeftY>'''
text += str(originY)
text += '''</UpperLeftY>
<LowerRightX>'''
text += str(originY)
text += '''</LowerRightX>
<LowerRightY>'''
text += str(originX)
text += '''</LowerRightY>
<TileLevel>'''
text += str(anzZooms)
text += '''</TileLevel>
<TileCountX>1</TileCountX>
<TileCountY>1</TileCountY>
<YOrigin>top</YOrigin>
</DataWindow>
<Projection>EPSG:'''
text += str(latestwkid)
text += '''</Projection>
<BlockSizeX>'''
text += str(blockX)
text += '''</BlockSizeX>
<BlockSizeY>'''
text += str(blockY)
text += '''</BlockSizeY>
<Cache />
</GDAL_WMS>'''
return text
def writeV2():
text = '''<GDAL_WMS>
<Service name="TMS">
<ServerUrl>'''
text += url
text += '''</ServerUrl>
</Service>
<DataWindow>
<UpperLeftX>-20037508.34</UpperLeftX>
<UpperLeftY>20037508.34</UpperLeftY>
<LowerRightX>20037508.34</LowerRightX>
<LowerRightY>-20037508.34</LowerRightY>
<TileLevel>'''
text += str(anzZooms)
text += '''</TileLevel>
<TileCountX>1</TileCountX>
<TileCountY>1</TileCountY>
<YOrigin>top</YOrigin>
</DataWindow>
<Projection>EPSG:900913</Projection>
<BlockSizeX>256</BlockSizeX>
<BlockSizeY>256</BlockSizeY>
<BandsCount>3</BandsCount>
<Cache />
</GDAL_WMS>'''
return text