可达性是指依靠交通设施在适当时间到达指定地点的便捷程度。它的高低取决于人的移动能力和由于移动而到达目的地的机会。而人的移动能力和到达目的地的移动机会排除自身因素外,主要取决于采用的交通方式、交通网的完善程度以及道路的通行质量等方面。(相关数据,后台回复20200315获取)
加权平均旅行时间
Li=∑j=1nMj∑j=1n(Tij×Mj)
Li 表示区域节点i可达性;
n 表示评价系统内除i地外的节点总数;
Tij 表示通过某交通设施和网络从节点i到达经济中心(或活动目的地)所花费的最短时间;
Mj 表示评价系统范围内某经济中心和活动目的地的某种社会经济要素的流量,即表示该经济中心的经济实力或对周边活动地区的辐射力或者吸引力,可采用GDP总值,人口总量等指标。
经济潜力
Pi=j=1∑nTijα Mj
Pi 表示节点 i 的经济潜力;
Tij、Mj 表示意义同上式;
α 表示节点 i 和 j 之间距离摩擦系数,通常取 1。
对于这两个指标,关键难点在于最短时间 Tij 的计算。为此,我们想你介绍stata的cntraveltime程序包。它可以基于百度地图API提取两个地点之间旅行所需的时间,此外还可以提取两坐标点之间详细的路径信息。语法格式与参数说明如下:
Syntax
cntraveltime, baidukey(string) {startlat(varname) startlng(varname) endlat(varname) endlng(varname)} [options]
+----------------+
----+ Search options +-------------------------------------------------------------------------------------------------------------------
instruction: If users need detail information about the route chosen, option instruction helps. The default is not to show this information.
transport(string) can change the travel mode. Based on the assumptions of this choice, BaiduMap will calculate the distance and duration between the specified place. When the option transport is empty, the default is "bus". There are three specific options of transport that "car", "bus" and "bike". other input will give an error.
intercity(numlist) can choose the detail preference when the given locations in different cities. This option can only be used when specify "bus" in transport(string). you can enter two numbers in the option, like intercity(1 2), where the first number represents the priority requirement and the second number specifies the mode of transportation. If the option is empty, both two numbers are 0. The first number represents the priority requirement where 0 is "as quickly as possible", 1 is "Start as early as possible" and 2 is "as cheap as possible". The second number specifies the mode of transportation where 0 is "train", 1 is "plane" and 2 is "bus"
tactic(real) can choose the detail preference when the given locations in same cities. Please note that if the transport content is different, the effective range and meaning of the tactic are also different. Enter the number in the option and the preferences
represented by different numbers are as follows.
bus 0: default, recommendation
bus 1: Less transfer
bus 2: less walk
bus 3: no subway
bus 4: as quickly as possible
bus 5: subway
car 0: default
car 3: avoid high speed
car 4: high speed priority
car 5: avoid congested sections
car 6: avoiding toll stations
car 7: both 4 and 5
car 8: both 3 and 4
car 9: both 4 and 6
car 10: both 6 and 8
car 11: both 3 and 6
bike 0: default, common
bike 1: electric bicycle
必要参数
baidukey(string)、startlat(varname)、startlng(varname)、endlat(varname)、endlng(varname)分别表达百度地图密钥(上期已经提到)、起始点纬度坐标、起始点经度坐标、终点纬度坐标、终点经度坐标。
可选参数:
instruction用于提供详细路径信息;transport(string)用于指定旅行方式,用三个选项 car、 bus、 bike,默认为 bus;intercity(numlist)指定当两点位于不同城市时的路径偏好,该选项只有在transport(string)设置为 bus 时才能使用。该选项可以填入两个参数:第一个参数指定优先需求,可填 0(尽可能快) 或 1(尽可能早) 或 2(尽可能便宜);第二个参数可填 0(火车)或 1(飞机)或 2(公交)。tactic(real)指定同城地点间的路线偏好,具体设置语法格式与参数说明已经给出。这里我们用到的是285个地级市的经纬度数据,计算其他284个地级市到北京市的最短旅行时间与距离:
cd "E:/微信/20200315 可达性"
* 导入数据
import excel "E:\微信\20200315 可达性\数据.xlsx", sheet("Sheet1") firstrow
save data.dta, replace
* 提取北京坐标为向量
gen startlat = lat[1]
gen startlng = lon[1]
keep city id code lat lon startlat startlng
cntraveltime, baidukey(zbLsuDDL4CS2U0M4KezOZZbGUY9iWtVf) startlat(startlat) startlng(startlng) endlat(lat) endlng(lon) intercity(0 0) tactic(2)
please check the information of location in 59
please check the information of location in 133
please check the information of location in 164
please check the information of location in 166
please check the information of location in 168
please check the information of location in 169
please check the information of location in 171
please check the information of location in 172
please check the information of location in 174
please check the information of location in 227
please check the information of location in 228
please check the information of location in 254
please check the information of location in 285
这里一些地区的计算结果出现问题,一方面可能是因为所用的经纬度为所在地区质心点的坐标,某些地区的质心位置可能很奇怪,无法计算。这种情况下换成行政或者经济中心的坐标数据可以在很大程度上得到解决;两一方面,可能是地区本身的特殊性导致的,
下面列示前10条结果:
list startlat startlng lat lon distance duration in 1/10
+--------------------------------------------------------------------+
| startlat startlng lat lon distance duration |
|--------------------------------------------------------------------|
1. | 40.2182 116.43689 40.2182 116.43689 . . |
2. | 40.2182 116.43689 39.352911 117.35321 86001 20268 |
3. | 40.2182 116.43689 38.114918 114.46721 60888 16802 |
4. | 40.2182 116.43689 39.706129 118.36456 92562 21401 |
5. | 40.2182 116.43689 40.051379 119.19456 98919 28475 |
|--------------------------------------------------------------------|
6. | 40.2182 116.43689 36.542102 114.50445 64580 20707 |
7. | 40.2182 116.43689 37.245721 114.80611 77277 21829 |
8. | 40.2182 116.43689 39.056857 115.10691 277476 27296 |
9. | 40.2182 116.43689 40.858124 115.08483 80482 21700 |
10. | 40.2182 116.43689 41.374961 117.55965 37607 29898 |
+--------------------------------------------------------------------+

扫码加好友,拉您进群



收藏
