m0_74879466 2024-03-20 21:27 采纳率: 73.4%
浏览 8
已结题

做中国热力地图报错不显示

做中国热力地图报错不显示

VM646 jquery.3.6.min.js:2 
 jQuery.Deferred exception: china is not defined ReferenceError: china is not defined
    at initMap (http://127.0.0.1:8000/chartjs/:953:38)
    at HTMLDocument.<anonymous> (http://127.0.0.1:8000/chartjs/:554:9)
    at e (http://127.0.0.1:8000/static/js/jquery.3.6.min.js:2:30038)
    at t (http://127.0.0.1:8000/static/js/jquery.3.6.min.js:2:30340) undefined
VM646 jquery.3.6.min.js:2 
 Uncaught ReferenceError: china is not defined
    at initMap (chartjs/:953:38)
    at HTMLDocument.<anonymous> (chartjs/:554:9)
    at e (VM646 jquery.3.6.min.js:2:30038)
    at t (VM646 jquery.3.6.min.js:2:30340)


怎么改

  • 写回答

2条回答 默认 最新

  • CSDN-Ada助手 CSDN-AI 官方账号 2024-03-22 07:03
    关注

    【相关推荐】



    • 帮你找了个相似的问题, 你可以看下: https://ask.csdn.net/questions/7478977
    • 这篇博客你也可以参考下:显示地图不出来的问题解决
    • 除此之外, 这篇博客: 高德地图自定义主题地图,盖住中国红色边境线中的 实现思路 部分也许能够解决你的问题, 你可以仔细阅读以下内容或跳转源博客中阅读:
      绘制地图的时候先不要绘制边境线
    •  new AMap.Map({
       		...,
       		features: ['bg', 'building', 'point'],
      })
      
      1. 获取中国地图的数据,然后盖住默认的中国地图
      AMap.plugin('AMap.DistrictSearch', function () {
                      const districtSearch = new AMap.DistrictSearch({
                          subdistrict: 0,   //获取边界不需要返回下级行政区
                          extensions: 'all',  //返回行政区边界坐标组等具体信息
                          level: 'province'  //查询行政级别为 省
                      })
                      // 搜索所有省/直辖市信息
                      districtSearch.search('中国', function (status: any, result: any) {
                          // 查询成功时,result即为对应的行政区信息
                          if (status === 'complete') {
                              resolve(result);
                          } else {
                              result(null);
                          }
                      })
                  })
      13:47
      const handlePolygon = (map: any, result: any) => {
              const bounds = result.districtList[0].boundaries;
              const polygons = [];
              if (bounds) {
                  for (let i = 0, l = bounds.length; i < l; i++) {
                      //生成行政区划polygon
                      const polygon = new AMap.Polygon({
                          strokeWeight: 6,
                          path: bounds[i],
                          fillOpacity: .3,
                          fillColor: '#000412',
                          strokeOpacity: 1,
                          strokeColor: '#000A22'
                      });
                      polygons.push(polygon);
                  }
              }
              map.add(polygons);
              setTimeout(() => {
                  map.setFeatures(['bg', 'road', 'building', 'point']); // 多个种类要素显示
              }, 3000)
              // map.setFitView(polygons);//视口自适应
          }
      

    如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 3月31日
  • 已采纳回答 3月23日
  • 创建了问题 3月20日