-
Notifications
You must be signed in to change notification settings - Fork 0
Заметка: Получение позиций транспорта
Походу запрос такого типа делает это (или не это, но все равно более чем заслуживает внимания):
Результат:
Нажать вот сюда чтобы увидеть большой и очень толстый JSON
{
"data": [
{
"type": "FeatureCollection",
"properties": {
"VehicleMetaData": {
"id": "mosobl%5Fdta|1023",
"Transport": {
"id": "2037281384",
"lineId": "2037272262",
"name": "472",
"Types": [
"bus"
],
"type": "bus"
}
}
},
"features": [
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[
37.516835,
55.939547
],
[
37.516912999999995,
55.939392
]
]
},
"properties": {
"type": "Feature",
"TrajectorySegmentMetaData": {
"duration": 5,
"time": 1552392220
}
}
},
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[
37.516912999999995,
55.939392
],
[
37.516920999999996,
55.939377
],
[
37.516948,
55.939322
],
[
37.516996999999996,
55.939226999999995
],
[
37.517132,
55.938964
],
[
37.517196999999996,
55.938837
],
[
37.517314999999996,
55.938598999999996
],
[
37.517478,
55.938275
],
[
37.517645,
55.937945
],
[
37.517652,
55.937931999999996
]
]
},
"properties": {
"type": "Feature",
"TrajectorySegmentMetaData": {
"duration": 44,
"time": 1552392225
}
}
},
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[
37.517652,
55.937931999999996
],
[
37.517663,
55.937908
]
]
},
"properties": {
"type": "Feature",
"TrajectorySegmentMetaData": {
"duration": 11,
"time": 1552392269
}
}
}
]
},
{
"type": "FeatureCollection",
"properties": {
"VehicleMetaData": {
"id": "mosobl%5Fdta|1026",
"Transport": {
"id": "2037281383",
"lineId": "2037272262",
"name": "472",
"Types": [
"bus"
],
"type": "bus"
}
}
},
"features": [
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[
37.434905,
55.874632
],
[
37.435100999999996,
55.874592
],
[
37.435359999999996,
55.874537
],
[
37.435795,
55.874427
],
[
37.436077,
55.874345
],
[
37.436259,
55.874288
],
[
37.436405,
55.874233
],
[
37.436538,
55.874184
],
[
37.436665,
55.874131999999996
],
[
37.436747,
55.874098999999994
]
]
},
"properties": {
"type": "Feature",
"TrajectorySegmentMetaData": {
"duration": 21,
"time": 1552392220
}
}
},
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[
37.436747,
55.874098999999994
],
[
37.436783999999996,
55.874083999999996
],
[
37.436893999999995,
55.874032
],
[
37.437051,
55.873953
]
]
},
"properties": {
"type": "Feature",
"TrajectorySegmentMetaData": {
"duration": 4,
"time": 1552392241
}
}
},
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[
37.437051,
55.873953
],
[
37.437051,
55.873953
]
]
},
"properties": {
"type": "Feature",
"TrajectorySegmentMetaData": {
"duration": 9,
"time": 1552392245
}
}
},
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[
37.437051,
55.873953
],
[
37.437056,
55.873951
],
[
37.437113,
55.873922
],
[
37.437278,
55.873835
],
[
37.437343,
55.873799
]
]
},
"properties": {
"type": "Feature",
"TrajectorySegmentMetaData": {
"duration": 3,
"time": 1552392254
}
}
},
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[
37.437343,
55.873799
],
[
37.437436999999996,
55.873746
],
[
37.437704,
55.873583999999994
],
[
37.438392,
55.873152
],
[
37.43909,
55.872710999999995
]
]
},
"properties": {
"type": "Feature",
"TrajectorySegmentMetaData": {
"duration": 20,
"time": 1552392257
}
}
},
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[
37.43909,
55.872710999999995
],
[
37.439298,
55.87258
]
]
},
"properties": {
"type": "Feature",
"TrajectorySegmentMetaData": {
"duration": 3,
"time": 1552392277
}
}
}
]
},
{
"type": "FeatureCollection",
"properties": {
"VehicleMetaData": {
"id": "mosobl%5Fdta|1027",
"Transport": {
"id": "2037281384",
"lineId": "2037272262",
"name": "472",
"Types": [
"bus"
],
"type": "bus"
}
}
},
"features": [
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[
37.460198999999996,
55.882593
],
[
37.460358,
55.882596
]
]
},
"properties": {
"type": "Feature",
"TrajectorySegmentMetaData": {
"duration": 1,
"time": 1552392220
}
}
},
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[
37.460358,
55.882596
],
[
37.460732,
55.882605
],
[
37.461152,
55.882614
],
[
37.461721,
55.88263
],
[
37.461861999999996,
55.882635
],
[
37.462015,
55.882639999999995
],
[
37.462177,
55.882647999999996
],
[
37.462339,
55.882658
],
[
37.462485,
55.882667999999995
],
[
37.462658,
55.88268
],
[
37.46284,
55.882695
],
[
37.463023,
55.882708
]
]
},
"properties": {
"type": "Feature",
"TrajectorySegmentMetaData": {
"duration": 6,
"time": 1552392221
}
}
},
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[
37.463023,
55.882708
],
[
37.463085,
55.882712
],
[
37.463285,
55.882726999999996
],
[
37.463477999999995,
55.882743
],
[
37.463879,
55.882779
],
[
37.464138,
55.882802999999996
],
[
37.464380999999996,
55.882827
],
[
37.464566999999995,
55.882847
],
[
37.464755,
55.882867999999995
],
[
37.464962,
55.882892
],
[
37.465274,
55.882932
],
[
37.465517,
55.882963
],
[
37.465652,
55.882981
]
]
},
"properties": {
"type": "Feature",
"TrajectorySegmentMetaData": {
"duration": 13,
"time": 1552392227
}
}
},
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[
37.465652,
55.882981
],
[
37.465754,
55.882994999999994
],
[
37.465835999999996,
55.883005999999995
],
[
37.466015999999996,
55.88303
],
[
37.466041,
55.883033999999995
]
]
},
"properties": {
"type": "Feature",
"TrajectorySegmentMetaData": {
"duration": 2,
"time": 1552392240
}
}
},
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[
37.466041,
55.883033999999995
],
[
37.466041,
55.883033999999995
]
]
},
"properties": {
"type": "Feature",
"TrajectorySegmentMetaData": {
"duration": 7,
"time": 1552392242
}
}
},
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[
37.466041,
55.883033999999995
],
[
37.466042,
55.883033999999995
],
[
37.466167,
55.883053999999994
],
[
37.466338,
55.88308
],
[
37.466426,
55.883095
]
]
},
"properties": {
"type": "Feature",
"TrajectorySegmentMetaData": {
"duration": 2,
"time": 1552392249
}
}
},
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[
37.466426,
55.883095
],
[
37.466985,
55.88319
],
[
37.46749,
55.883281
],
[
37.467791999999996,
55.883337
],
[
37.468067,
55.883393
],
[
37.468371,
55.883457
],
[
37.468717999999996,
55.883533
],
[
37.468908,
55.883575
]
]
},
"properties": {
"type": "Feature",
"TrajectorySegmentMetaData": {
"duration": 12,
"time": 1552392251
}
}
},
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[
37.468908,
55.883575
],
[
37.469086,
55.883615
],
[
37.4693,
55.883663999999996
],
[
37.469463,
55.883702
],
[
37.469626,
55.883742999999996
],
[
37.469755,
55.883773999999995
],
[
37.469896,
55.883809
],
[
37.47041,
55.883939999999996
],
[
37.470822999999996,
55.884043999999996
],
[
37.471209,
55.884139999999995
],
[
37.471312999999995,
55.884167
]
]
},
"properties": {
"type": "Feature",
"TrajectorySegmentMetaData": {
"duration": 10,
"time": 1552392263
}
}
},
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[
37.471312999999995,
55.884167
],
[
37.472344,
55.884426
],
[
37.472611,
55.884493
]
]
},
"properties": {
"type": "Feature",
"TrajectorySegmentMetaData": {
"duration": 7,
"time": 1552392273
}
}
}
]
},
{
"type": "FeatureCollection",
"properties": {
"VehicleMetaData": {
"id": "mosobl%5Fdta|812",
"Transport": {
"id": "2037281383",
"lineId": "2037272262",
"name": "472",
"Types": [
"bus"
],
"type": "bus"
}
}
},
"features": [
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[
37.510376,
55.950651
],
[
37.510427,
55.950683999999995
],
[
37.510557999999996,
55.950768
],
[
37.510688,
55.950843
],
[
37.510895,
55.950945
],
[
37.511072999999996,
55.951021999999995
],
[
37.511232,
55.951114
],
[
37.511323,
55.951192999999996
],
[
37.51134,
55.951234
],
[
37.511354,
55.951277999999995
],
[
37.51135,
55.951311999999994
],
[
37.511344,
55.951336999999995
],
[
37.511328999999996,
55.951361
],
[
37.511308,
55.95138
],
[
37.511249,
55.951415
],
[
37.511175,
55.951449
],
[
37.511097,
55.951468999999996
],
[
37.511026,
55.95148
],
[
37.510943999999995,
55.951477999999994
],
[
37.510875999999996,
55.951471999999995
],
[
37.510797,
55.951448
],
[
37.510732999999995,
55.951418
]
]
},
"properties": {
"type": "Feature",
"TrajectorySegmentMetaData": {
"duration": 14,
"time": 1552392220
}
}
},
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[
37.510732999999995,
55.951418
],
[
37.510723999999996,
55.951414
],
[
37.510667,
55.951378999999996
],
[
37.510622,
55.951342
],
[
37.510556,
55.951283999999994
],
[
37.51049,
55.951217
],
[
37.510444,
55.951172
],
[
37.510352,
55.9511
],
[
37.509848999999996,
55.950745
],
[
37.509385,
55.950419
],
[
37.509246,
55.950320999999995
],
[
37.509097,
55.95021
]
]
},
"properties": {
"type": "Feature",
"TrajectorySegmentMetaData": {
"duration": 15,
"time": 1552392234
}
}
},
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[
37.509097,
55.95021
],
[
37.508852,
55.950027
],
[
37.508649,
55.949872
],
[
37.508465,
55.949709
],
[
37.508277,
55.949526999999996
],
[
37.508168,
55.949414
],
[
37.508049,
55.949265999999994
],
[
37.507754999999996,
55.94905
],
[
37.507604,
55.948949
]
]
},
"properties": {
"type": "Feature",
"TrajectorySegmentMetaData": {
"duration": 23,
"time": 1552392249
}
}
},
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[
37.507604,
55.948949
],
[
37.507397,
55.948809999999995
],
[
37.507325,
55.948769
]
]
},
"properties": {
"type": "Feature",
"TrajectorySegmentMetaData": {
"duration": 8,
"time": 1552392272
}
}
}
]
},
{
"type": "FeatureCollection",
"properties": {
"VehicleMetaData": {
"id": "mosobl%5Fdta|844",
"Transport": {
"id": "2037281384",
"lineId": "2037272262",
"name": "472",
"Types": [
"bus"
],
"type": "bus"
}
}
},
"features": [
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[
37.519835,
55.937760999999995
],
[
37.519836,
55.937762
]
]
},
"properties": {
"type": "Feature",
"TrajectorySegmentMetaData": {
"duration": 86400,
"time": 1552392106
}
}
}
]
}
]
}
!!! ПРЕКРАТИ СКРОЛЛИТЬ СТРАНИЦУ ТЕБЕ СКАЗАЛИ !!!
ОК, Яндекс не выдает актуальные координаты транспорта, он выдает "траекторию" по каждому автобусу в виде отрезков, и отрисовывает движение машины в реальном времени. Адовая дичь. Скорее всего это сделано для снижения нагрузки на сервер, один раз отдали данные пользователю и отрисовываем их после этого, не запрашивая новые каждую секунду, все плавно, юзер счастлив (пока не попал в ситуацию что приложуха показало "твой бас уже здесь", а он там в пробке стоит за квартал на светофоре, КАК У МЕНЯ КАЖДОЕ УТРО).
Как минимум этот запрос сильно упрощает подсчет количества машин на маршруте, но теперь жизненно необходимо получать "Оригинальный JSON" (и этот тоже) через Selenium.
UPD 16.03.2019: Открытая страница яндекс-карт выполняет этот запрос постоянно, видимо обновляя данные. Если повезет - они кэшируются.