Fix contour lines closure in osm file generation

This commit is contained in:
yvecai 2012-10-25 23:55:48 +02:00
parent 78a2f42bd2
commit 8074505a42
2 changed files with 10 additions and 6 deletions

View file

@ -4,13 +4,15 @@ import os, sys
from lxml import etree
from optparse import OptionParser
def listsplit(tosplit, n=50):
def listsplit(tosplit, n):
splited=[]
i=0
while i < (len(tosplit)-49):
splited.append(tosplit[i:i+49])
i+=50
splited.append(tosplit[i:])
while i < (len(tosplit)-n):
splited.append(tosplit[i:i+n])
i+=n
last=tosplit[i:]
last.append(tosplit[0])# first == last to close
splited.append(last)
return splited
@ -72,6 +74,8 @@ if len(sf.shapes()) != 0:
for i in range(firstindex,lastindex):
way.append(etree.Element("nd", ref=str(i)))
#way.append(etree.Element("nd", ref=str(firstindex)))
# tags:
way.append(etree.Element("tag",k="elevation", v=str(height)))
way.append(etree.Element("tag",k="contour", v="elevation"))

View file

@ -320,7 +320,7 @@ html, body {
<input type="button" value="Clear" onclick="clearList();">
</form>
<hr>
Right-click on tile to add to or remove from the tile list:
Simple click on map (without drag) to add to or remove from the tile list
<hr>
</div>
<div id="tiles"></div>