【发布时间】:2023-03-24 14:05:01
【问题描述】:
我正在使用here 提供的辅助函数,对距离和颜色进行了一些修改。我在没有更改的情况下尝试了它,结果相同。我注意到如果我使用“自然”标签,水道会延伸到数字之外,但我没有在这些中使用它,只是“建筑”。
正在使用的代码:
import osmnx as ox
from IPython.display import Image
ox.config(log_console=True, use_cache=True)
bgcolor="#343434"
edge_color="#FFB0E2"
bldg_color="#F4FF6E"
point = (40.7154,-73.9853)
place = 'New York City, NY'
dist = 3000
dpi = 100
# helper funcion to get one-square-mile street networks, building.
footprints, and plot them
def make_plot(place, point, dist, network_type='all',
bldg_color=bldg_color, dpi=dpi,
default_width=0.5,
street_widths = {
"footway": 0.25,
"steps": 0.25,
"pedestrian": 0.25,
"service": 0.25,
"path": 0.25,
"track": 0.25,
"primary": 1,
"secondary": 0.5,
"motorway": 2 ,
}):
tags = {
#'amenity':True,
'building':True,
#'geological':True,
#'historic':True,
#'landuse':['retail', 'commercial'],
#'natural':True,
#'waterway':True,
}
gdf = ox.geometries.geometries_from_point(center_point=point,
tags=tags, dist=dist)
fig, ax = ox.plot.plot_figure_ground(point=point, dist=dist,
network_type=network_type,
default_width=default_width,
street_widths=street_widths,
edge_color=edge_color ,save=False, show=False,
close=True, bgcolor=bgcolor)
fig, ax = ox.plot.plot_footprints(gdf, ax=ax, color=bldg_color,
save=True, show=False, close=True,
filepath="images/us_cities/{}-dist{}-
dpi{}.png".format(place,dist,dpi), dpi=dpi)
make_plot(place, point, dist)
示例输出:
-
较大的边距和足迹未填充图像。我在生成地图时注意到日志中有一些东西;创建了两个不同大小的 bbox。它们在下面的日志条目中以粗体显示:
-
2020-10-04 11:37:28 配置 osmnx 2020-10-04 11:37:28 创建
bbox 3000 m from (40.7154, -73.9853): 40.74237961006479,40.68842038993522,-73.9497049233066,-74.02089507669339 -
2020-10-04 11:37:28 将 GeoDataFrame 投影到 +proj=utm +zone=18
+ellps=WGS84 +datum=WGS84 +units=m +no_defs +type=crs -
2020-10-04 11:37:28 将 GeoDataFrame 投影到 epsg:4326
-
2020-10-04 11:37:28 从 1 中的 API 请求多边形内的数据 请求
-
2020-10-04 11:37:29 在进行 HTTP POST 之前暂停 0 秒 请求
-
2020-10-04 11:37:37 从 overpass-api.de 下载 25,341.0KB 2020-10-04 11:37:39 保存对缓存文件“cache/5c31a2f980a9dc4969b2dd7541ef5eff.json”的响应
-
2020-10-04 11:37:39 在 1 个请求中从 API 获取多边形内的所有几何数据
-
2020-10-04 11:37:39 JSON 响应中的 196787 个元素(包括每个节点)。
-
2020-10-04 11:37:39 将元素转换为几何图形
-
2020-10-04 11:37:42 没有为 https://www.openstreetmap.org/relation/7774552 创建外部多边形
-
2020-10-04 11:37:42 30055 在字典中创建的几何图形
-
2020-10-04 11:37:42 376 个未标记的几何图形已删除
-
2020-10-04 11:37:53 为 29679 个几何图形创建了 r-tree 空间索引
-
2020-10-04 11:37:54 识别出多边形内的 29669 个几何图形
-
2020-10-04 11:37:54 多边形过滤器移除了 10 个几何图形
-
2020-10-04 11:37:54 标记过滤器删除了 413 个几何图形
-
2020-10-04 11:37:56 最终 GeoDataFrame 中的 29265 个几何图形
-
2020-10-04 11:37:56 创建 bbox 3600.0 m 从 (40.7154, -73.9853): 40.747775532077746,40.68302446792226,-73.94258590796792,-74.02801,-74.02801
-
2020-10-04 11:37:57 将 GeoDataFrame 投影到 +proj=utm +zone=18 +ellps=WGS84 +datum=WGS84 +units=m +no_defs +type=crs
-
2020-10-04 11:37:57 将 GeoDataFrame 投影到 epsg:4326
-
2020-10-04 11:37:57 将 GeoDataFrame 投影到 +proj=utm +zone=18 +ellps=WGS84 +datum=WGS84 +units=m +no_defs +type=crs
-
2020-10-04 11:37:57 将 GeoDataFrame 投影到 epsg:4326
-
2020-10-04 11:37:57 在 1 个请求中从 API 请求多边形内的数据
-
2020-10-04 11:37:57 在发出 HTTP POST 请求前暂停 0 秒
【问题讨论】:
-
请参阅 StackOverflow 的指南,了解如何在本网站提出问题以及如何提供完整的最小工作示例以允许其他人回答您的问题。
-
我更新了问题
标签: osmnx