显示带有传单的结果路由路径

发布于 2025-02-08 12:57:56 字数 3354 浏览 1 评论 0原文

我得到2分之间的路线:

{
  "routes": [
    {
      "overview_polyline": {
        "points": "m{f~D}_ygHp@wAJs@Is@eAsBGk@Hg@"
      },
      "legs": [
        {
          "summary": "میدان انقلاب - انقلاب",
          "distance": {
            "value": 209.0,
            "text": "۲۲۵ متر"
          },
          "duration": {
            "value": 13.0,
            "text": "کمتر از ۱ دقیقه"
          },
          "steps": [
            {
              "name": "بزرگراه اهواز-حمیدیه",
              "instruction": "در جهت شرق در بزرگراه اهواز-حمیدیه قرار بگیرید",
              "bearing_after": 119,
              "type": "depart",
              "distance": {
                "value": 25.0,
                "text": "۲۵ متر"
              },
              "duration": {
                "value": 1.0,
                "text": "کمتر از ۱ دقیقه"
              },
              "polyline": "m{f~D}_ygHTm@",
              "start_location": [
                48.629912,
                31.333827
              ]
            },
            {
              "name": "انقلاب",
              "instruction": "در میدان انقلاب، از خروجی دوم، خارج شوید",
              "rotaryName": "میدان انقلاب",
              "bearing_after": 126,
              "type": "rotary",
              "modifier": "straight",
              "exit": 2,
              "distance": {
                "value": 101.0,
                "text": "۱۲۵ متر"
              },
              "duration": {
                "value": 5.0,
                "text": "کمتر از ۱ دقیقه"
              },
              "polyline": "wzf~DkaygHNWJQJs@Is@Yk@",
              "start_location": [
                48.630143,
                31.333717
              ]
            },
            {
              "name": "",
              "instruction": "به مسیر خود ادامه دهید",
              "bearing_after": 53,
              "type": "exit rotary",
              "modifier": "straight",
              "exit": 2,
              "distance": {
                "value": 83.0,
                "text": "۱۰۰ متر"
              },
              "duration": {
                "value": 8.0,
                "text": "کمتر از ۱ دقیقه"
              },
              "polyline": "szf~DigygHk@gAGk@Hg@",
              "start_location": [
                48.631088,
                31.333703
              ]
            },
            {
              "name": "انقلاب",
              "instruction": "در مقصد قرار دارید",
              "bearing_after": 0,
              "type": "arrive",
              "distance": {
                "value": 0.0,
                "text": ""
              },
              "duration": {
                "value": 0.0,
                "text": ""
              },
              "polyline": "}{f~DelygH",
              "start_location": [
                48.631869,
                31.333913
              ]
            }
          ]
        }
      ]
    }
  ]
}

步骤我们有4分:

[31.333827,48.629912], [31.333717,48.630143],, [31.333703,48.631088],, [31.333913,48.631869]

当我使用polyline时,我的输出如下图所示。但是真正的道路是另一回事。

我使用传单,并从另一台服务器获取映射的.png文件,然后从另一台服务器获取JSON字符串。 如何管理这个?

I get route between 2 Point :

{
  "routes": [
    {
      "overview_polyline": {
        "points": "m{f~D}_ygHp@wAJs@Is@eAsBGk@Hg@"
      },
      "legs": [
        {
          "summary": "میدان انقلاب - انقلاب",
          "distance": {
            "value": 209.0,
            "text": "۲۲۵ متر"
          },
          "duration": {
            "value": 13.0,
            "text": "کمتر از ۱ دقیقه"
          },
          "steps": [
            {
              "name": "بزرگراه اهواز-حمیدیه",
              "instruction": "در جهت شرق در بزرگراه اهواز-حمیدیه قرار بگیرید",
              "bearing_after": 119,
              "type": "depart",
              "distance": {
                "value": 25.0,
                "text": "۲۵ متر"
              },
              "duration": {
                "value": 1.0,
                "text": "کمتر از ۱ دقیقه"
              },
              "polyline": "m{f~D}_ygHTm@",
              "start_location": [
                48.629912,
                31.333827
              ]
            },
            {
              "name": "انقلاب",
              "instruction": "در میدان انقلاب، از خروجی دوم، خارج شوید",
              "rotaryName": "میدان انقلاب",
              "bearing_after": 126,
              "type": "rotary",
              "modifier": "straight",
              "exit": 2,
              "distance": {
                "value": 101.0,
                "text": "۱۲۵ متر"
              },
              "duration": {
                "value": 5.0,
                "text": "کمتر از ۱ دقیقه"
              },
              "polyline": "wzf~DkaygHNWJQJs@Is@Yk@",
              "start_location": [
                48.630143,
                31.333717
              ]
            },
            {
              "name": "",
              "instruction": "به مسیر خود ادامه دهید",
              "bearing_after": 53,
              "type": "exit rotary",
              "modifier": "straight",
              "exit": 2,
              "distance": {
                "value": 83.0,
                "text": "۱۰۰ متر"
              },
              "duration": {
                "value": 8.0,
                "text": "کمتر از ۱ دقیقه"
              },
              "polyline": "szf~DigygHk@gAGk@Hg@",
              "start_location": [
                48.631088,
                31.333703
              ]
            },
            {
              "name": "انقلاب",
              "instruction": "در مقصد قرار دارید",
              "bearing_after": 0,
              "type": "arrive",
              "distance": {
                "value": 0.0,
                "text": ""
              },
              "duration": {
                "value": 0.0,
                "text": ""
              },
              "polyline": "}{f~DelygH",
              "start_location": [
                48.631869,
                31.333913
              ]
            }
          ]
        }
      ]
    }
  ]
}

In Steps we have 4 points:

[31.333827,48.629912 ],
[31.333717,48.630143 ],
[31.333703,48.631088],
[31.333913,48.631869 ]

When I use polyline my output is like below picture. But real Path is another thing.

enter image description here

I use Leaflet and get my .png file for map from another server and get Json String from another server.
How can Manage this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

剑心龙吟 2025-02-15 12:57:56

匹配API的地图应解决您的问题。

A Map Matching API should solve your problem.

半仙 2025-02-15 12:57:56

原始指示API请求是什么?很好奇,看看为什么您要为那条路获得结果

What was the original directions API request? Curious to see why you're getting that result for that route

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文