def googleStreetView(values, feature, parent):
"""
Returns a path to a local Google Street View
image for the feature
"""
x,y = feature.geometry().asPoint()
baseurl = "https://maps.googleapis.com/maps/api/streetview?"
w = 150
h = 150
fov = 90
heading = 235
pitch = 10
params = "size={w}x{h}&".format(w,h)
params += "location={y},{x}&".format(y,x)
params += "fov={}&heading={}&pitch={}".format(fov, heading, pitch)
url = baseurl + params
tmpdir = "/qgis_data/tmp/"
img = tmpdir + str(feature.id()) + ".jpg"
if not os.path.isfile(img):
urllib.urlretrieve(url, img)
uri = "file://" + img
return uri
B06246_09_15-htmlbls.py 文件源码
python
阅读 18
收藏 0
点赞 0
评论 0
评论列表
文章目录