Exemple #1
0
def ProjPoint(e, n):
	try:
		x,y,z= ostn02.OSGB36_to_ETRS89(e, n)
		return osgb.grid_to_ll(x,y)
	except:
		#Use approximation
		return osgb.grid_to_ll(e,n)
def GetOsTile(tileCode = "so22nw", zoom = 12, out = None):

	tileBL = osgb.os_streetview_tile_to_grid(tileCode)
	tileTR = (tileBL[0]+5000, tileBL[1]+5000)
	tileBR = (tileBL[0]+5000, tileBL[1])
	tileTL = (tileBL[0], tileBL[1]+5000)

	x,y,z= ostn02.OSGB36_to_ETRS89(*tileBL)
	c1 = osgb.grid_to_ll(x,y)

	x,y,z= ostn02.OSGB36_to_ETRS89(*tileTR)
	c2 = osgb.grid_to_ll(x,y)

	x,y,z= ostn02.OSGB36_to_ETRS89(*tileBR)
	c3 = osgb.grid_to_ll(x,y)

	x,y,z= ostn02.OSGB36_to_ETRS89(*tileTL)
	c4 = osgb.grid_to_ll(x,y)

	lat = [c1[0], c2[0], c3[0], c4[0]]
	lon = [c1[1], c2[1], c3[1], c4[1]]

	minLat, maxLat = min(lat), max(lat)
	minLon, maxLon = min(lon), max(lon)

	tilex1, tiley1 = slippytiles.deg2num(maxLat, minLon, zoom)
	tilex2, tiley2 = slippytiles.deg2num(minLat, maxLon, zoom)

	tilePath = "/home/tim/dev/batch-garmin-map/{0}/{1}/{2}.osm.bz2"

	fileList = []
	for x in range(tilex1, tilex2+1):
		for y in range(tiley1, tiley2+1):
			fina = tilePath.format(zoom, x, y)
			print x, y, fina
			if os.path.isfile(fina):
				fileList.append(fina)

	mergeTiles.MergeFiles(fileList, out)
def ProjPoint(e, n):
	x,y,z= ostn02.OSGB36_to_ETRS89(e, n)
	return osgb.grid_to_ll(x,y)