我正在使用OSMNx并尝试检索起点和终点之间的地址,如下图所示。
import osmnx as ox
import networkx as nx
import matplotlib.pyplot as plt
address='45 Stodart St, Colac VIC 3250'
G = ox.graph_from_address(address, distance=500, network_type="drive")
fig1, ax1 = ox.plot_graph(G,node_size=0, edge_linewidth=0.5, dpi=250)
答案 0 :(得分:1)
是否可以提取两个点或节点之间的地址?
是:
import osmnx as ox
ox.config(use_cache=True, log_console=True)
address = '20 W 34th St, Manhattan, NY, USA'
G = ox.graph_from_address(address, dist=500, network_type='drive')
# osmids of nodes at either end of block
# or you could do this programmatically with ox.geocode and ox.get_nearest_node
osmids = [42437644, 42430304]
# bounding box around those nodes, buffered as needed
polygon = ox.graph_to_gdfs(G, edges=False).loc[osmids, 'geometry'].unary_union.envelope
polygon_proj, crs = ox.projection.project_geometry(polygon)
polygon_buff, crs = ox.projection.project_geometry(polygon_proj.buffer(10), crs=crs, to_latlong=True)
# get building footprints and show their addresses
fp = ox.footprints_from_polygon(polygon)
cols = [c for c in fp.columns if 'addr' in c]
fp[cols]
是的,这是可能的。但是由于您的特定期望位置是不可能的,因为OpenStreetMap在那里不包含建筑物或地址信息。您发布的屏幕截图来自Google Maps,而不是OpenStreetMap。
答案 1 :(得分:0)
检索目标区域的所有街道。
###### ##### ##### #### ##### ##### ## #### ###### ####
# # # # # # # # # # # # # # # # #
##### # # # # # # # # # # # # # ##### ####
# ##### ##### # # ##### ##### ###### # ### # #
# # # # # # # # # # # # # # # # #
###### # # # # #### # # # # # #### ###### ####
# ------------------------------------------------------------------------------
# HTTP > SERVER > ERROR_PAGE :: WWW.EXAMPLE1.COM
# ------------------------------------------------------------------------------
# Optionally include these error pages as a file.
# include /etc/nginx/conf.d/www.example1.com_error_page.conf;
# ------------------------------------------------------------------------------
# Description
# Defines the URI that will be shown for the specified errors.
#
# ------------------------------------------------------------------------------
#
#
# 400 Bad Request
error_page 400 @400;
# #### #### ## ##### # #### # #
# # # # # # # # # # # ## #
# # # # # # # # # # # # #
# # # # ###### # # # # # # #
# # # # # # # # # # # # ##
###### #### #### # # # # #### # #
# An http 400 error must be returned in this manner for custom http error pages to be served correctly.
location @400 {
rewrite ^(.*)$ /http-error/400-error.html break;
}
# 401 Unauthorized
error_page 401 @401;
# #### #### ## ##### # #### # #
# # # # # # # # # # # ## #
# # # # # # # # # # # # #
# # # # ###### # # # # # # #
# # # # # # # # # # # # ##
###### #### #### # # # # #### # #
# An http 401 error must be returned in this manner for custom http error pages to be served correctly.
location @401 {
rewrite ^(.*)$ /http-error/401-error.html break;
}
# 403 Forbidden
error_page 403 @403;
# #### #### ## ##### # #### # #
# # # # # # # # # # # ## #
# # # # # # # # # # # # #
# # # # ###### # # # # # # #
# # # # # # # # # # # # ##
###### #### #### # # # # #### # #
# An http 403 error must be returned in this manner for custom http error pages to be served correctly.
location @403 {
rewrite ^(.*)$ /http-error/403-error.html break;
}
# 404 Not Found
error_page 404 @404;
# #### #### ## ##### # #### # #
# # # # # # # # # # # ## #
# # # # # # # # # # # # #
# # # # ###### # # # # # # #
# # # # # # # # # # # # ##
###### #### #### # # # # #### # #
# An http 404 error must be returned in this manner for custom http error pages to be served correctly.
location @404 {
rewrite ^(.*)$ /http-error/404-error.html break;
}
# 405 Method Not Allowed
# unreachable do to nature of the error itself. here only for completeness.
# error_page 405 /http-error/405-error.html break;
# Request Timeout
error_page 408 @408;
# #### #### ## ##### # #### # #
# # # # # # # # # # # ## #
# # # # # # # # # # # # #
# # # # ###### # # # # # # #
# # # # # # # # # # # # ##
###### #### #### # # # # #### # #
# An http 408 error must be returned in this manner for custom http error pages to be served correctly.
location @408 {
rewrite ^(.*)$ /http-error/408-error.html break;
}
# 500 Internal Server Error
error_page 500 @500;
# #### #### ## ##### # #### # #
# # # # # # # # # # # ## #
# # # # # # # # # # # # #
# # # # ###### # # # # # # #
# # # # # # # # # # # # ##
###### #### #### # # # # #### # #
# An http 500 error must be returned in this manner for custom http error pages to be served correctly.
location @500 {
rewrite ^(.*)$ /http-error/500-error.html break;
}
# 502 Bad Gateway
error_page 502 @502;
# #### #### ## ##### # #### # #
# # # # # # # # # # # ## #
# # # # # # # # # # # # #
# # # # ###### # # # # # # #
# # # # # # # # # # # # ##
###### #### #### # # # # #### # #
# An http 502 error must be returned in this manner for custom http error pages to be served correctly.
location @502 {
rewrite ^(.*)$ /http-error/502-error.html break;
}
# 503 Service Unavailable
error_page 503 @503;
# #### #### ## ##### # #### # #
# # # # # # # # # # # ## #
# # # # # # # # # # # # #
# # # # ###### # # # # # # #
# # # # # # # # # # # # ##
###### #### #### # # # # #### # #
# An http 503 error must be returned in this manner for custom http error pages to be served correctly.
location @503 {
rewrite ^(.*)$ /http-error/503-error.html break;
}
# 504 Gateway Time-out
error_page 504 @504;
# #### #### ## ##### # #### # #
# # # # # # # # # # # ## #
# # # # # # # # # # # # #
# # # # ###### # # # # # # #
# # # # # # # # # # # # ##
###### #### #### # # # # #### # #
# An http 504 error must be returned in this manner for custom http error pages to be served correctly.
location @504 {
rewrite ^(.*)$ /http-error/504-error.html break;
}
# 505 HTTP Version Not Supported
error_page 505 @505;
# #### #### ## ##### # #### # #
# # # # # # # # # # # ## #
# # # # # # # # # # # # #
# # # # ###### # # # # # # #
# # # # # # # # # # # # ##
###### #### #### # # # # #### # #
# An http 505 error must be returned in this manner for custom http error pages to be served correctly.
location @505 {
rewrite ^(.*)$ /http-error/505-error.html break;
}
# 511 HTTP Version Not Supported
error_page 511 @511;
# #### #### ## ##### # #### # #
# # # # # # # # # # # ## #
# # # # # # # # # # # # #
# # # # ###### # # # # # # #
# # # # # # # # # # # # ##
###### #### #### # # # # #### # #
# An http 511 error must be returned in this manner for custom http error pages to be served correctly.
location @511 {
rewrite ^(.*)$ /http-error/511-error.html break;
}
# #### #### ## ##### # #### # #
# # # # # # # # # # # ## #
# # # # # # # # # # # # #
# # # # ###### # # # # # # #
# # # # # # # # # # # # ##
###### #### #### # # # # #### # #
# example1.com internal error pages located at...
location /http-error/ {
# Specifies that a given location can only be used for internal requests.
# returns a 404 Not Found http error if accessed directly.
internal;
}