Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

map 自动读取json文件,刷新页面后数据不丢失 #105

Open
tangyang9988 opened this issue Mar 26, 2020 · 1 comment
Open

map 自动读取json文件,刷新页面后数据不丢失 #105

tangyang9988 opened this issue Mar 26, 2020 · 1 comment

Comments

@tangyang9988
Copy link

我想要自动读取json文件,不要手动配置。做法如下:在atlas.js中给定本地json的路径,利用ajax读取json内容,将json内容传给ctrl.panel.mapSrc[j]后可以显示节点信息,但是整个页面刷新之后数据没了。
问题:如何在不点击右上角的Save dashboard情况下,自动保存我们的地图数据,刷新页面不影响???源码怎么去改???
我的json文件如下:急急急!!!!
{
"results": [
{
"links": [

    {
      "path": [
        {
          "lon": "120.291547",
          "order": "1",
          "lat": "31.926044"
        },
        {
          "lon": "119.725848",
          "order": "2",
          "lat": "31.501712"
        }
      ],
      "name": "Link Name"
    },
    {
      "path": [
        {
          "lon": "120.291547",
          "order": "3",
          "lat": "31.926044"
        },
        {
          "lon": "120.304573",
          "order": "3",
          "lat": "31.686696"
        }
      ]
    }
  ],
  "endpoints": [
    {
      "pop_id": "jp",
      "lon": "120.291547",
      "real_lon": null,
      "real_lat": null,
      "name": "endpoint1",
      "lat": "31.926044"
    },
    {
      "pop_id": "usa",
      "lon": "120.304573",
      "real_lon": null,
      "real_lat": null,
      "name": "endpoint2",
      "lat": "31.686696"
    },
    {
      "pop_id": "ch",
      "lon": "120.318559",
      "real_lon": null,
      "real_lat": null,
      "name": "endpoint3",
      "lat": "31.498764"
    },
    {
      "pop_id": "yx",
      "lon": "119.725848",
      "real_lon": null,
      "real_lat": null,
      "name": "endpoint4",
      "lat": "31.501712"
    }
  ]
}

]
}

@daldoyle
Copy link
Contributor

Hi there,

Unfortunately I don't speak/read Chinese, but I was able to get a colleague to translate.

I want to automatically load json file without manually configuration. For example, define json file path in the atlas.js then use ajax to load json file. After json file is passed to ctrl.panel.mapSrc[j] the node information is able to show on the map. However, the data can’t be persistent after refreshing the page.
Question: Is there a way to automatically save the map data without clicking the Save dashboard on the top right? And make it persistent with page refreshing. Could you point me to the source code where controls that part? Here is my json file

If I'm reading this right, you want to load the map topology from an external resource. In the spot where you would put JSON normally, you should be able to just put a URL to a JSON file in some web accessible location and it will load that as the topology when it loads up. You can then have whatever external process regenerate that file and put it into the same location.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants