我从OSMX上阅读了这个toturial,并在同一张Map上创建了一组路线。我也知道我想画的假想边界的最小和最大纬度和经度是什么。我将协调保存为以下内容
# Based on some routing and comptation these are lat long of routing region within in m.bounds (far smaller)
min_lat = minimum(lats)
max_lat = maximum(lats)
min_lon = minimum(lons)
max_lon = maximum(lons)
然后添加另一个黑矩形我做的
flm = pyimport("folium")
matplotlib_cm = pyimport("matplotlib.cm")
matplotlib_colors = pyimport("matplotlib.colors")
cmap = matplotlib_cm.get_cmap("prism")
mf = flm.Map()
for k=1:length(links_o)
locs = [LLA(m.nodes[n],m.bounds) for n in links_o[k]]
flm.PolyLine(
[(loc.lat, loc.lon) for loc in locs ],
color=matplotlib_colors.to_hex(cmap(3))
).add_to(mf)
end
Route_BOUNDS = [(min_lon,min_lat),(max_lon,max_lat)] # added this
MAP_BOUNDS = [(m.bounds.min_y,m.bounds.min_x),(m.bounds.max_y,m.bounds.max_x)]
flm.Rectangle(MAP_BOUNDS, color="black",weight=6).add_to(mf)
flm.Rectangle(Route_BOUNDS, color="black",weight=6).add_to(mf) # and added this
mf.fit_bounds(MAP_BOUNDS)
mf
但是没有更小的矩形出现。如何在较大的矩形区域内添加另一个矩形区域?
1条答案
按热度按时间0g0grzrc1#
检查“较小”矩形的大小/尺寸。很可能它比“更大”或另一个地方比边界矩形,这就是为什么你没有看到它。您可以缩小以找出。
从代码中看,似乎你混淆了维度经度是“x维度”,纬度是“y维度”,而在代码中,情况正好相反。