无法实例化 geotiff 对象

问题描述

对于我的一个 Rails 应用程序,我一直在使用传单。到目前为止,我没有任何问题。最近我收到了在地图上显示栅格数据的新要求。我已按照文档 (https://github.com/stuartmatthews/leaflet-geotiff) 中的建议将 leaflet-geotiff 插件添加到我的应用程序中。 当我尝试在我的应用程序中初始化 geotiff 对象时,出现以下错误。请建议我。查看页面源码中可以看到所有指定的JS文件都加载了。

Ruby 版本:2.4.2 导轨版本:5.1.6 传单版本:~1.0.1 通过使用下面的代码,我试图实例化 LeafletGeotiff 对象。

var layer = L.leafletGeotiff("https://stuartmatthews.github.io/leaflet-geotiff/tif/wind_speed.tif",{renderer: null})
Uncaught Error: GeoTIFF not defined
    at e.initialize (l`enter code here`eaflet-geotiff.self-3b023cf9cd730ead94ff4236b8e9e14e025d783ef485c3b2013000bd873c6bcb.js?body=1:26)`enter code here`
    at new e (leaflet-src.self-6458f2197d3e43315b6f8998e986660f3128c4932534c33b02f5846113aba1f9.js?body=1:6)
    at Object.L.leafletGeotiff (leaflet-geotiff.self-3b023cf9cd730ead94ff4236b8e9e14e025d783ef485c3b2013000bd873c6bcb.js?body=1:296)
    at new MapunityMap (mapunity-lib.self-3b821f08e8bc8692172b65ef1f984b5b19c75e9c1c759a92c6a0d1acadbef1db.js?body=1:97)
    at MapunityMap (mapunity-lib.self-3b821f08e8bc8692172b65ef1f984b5b19c75e9c1c759a92c6a0d1acadbef1db.js?body=1:20)
    at HTMLDocument.<anonymous> (mississippi:293)
    at i (jquery.self-0c1f22fd006ec3137177f2e25c6077e6d62c8c5109c935f26654d1a3dc8a2eef.js?body=1:3)
    at Object.fireWith [as resolveWith] (jquery.self-0c1f22fd006ec3137177f2e25c6077e6d62c8c5109c935f26654d1a3dc8a2eef.js?body=1:3)
    at Function.ready (jquery.self-0c1f22fd006ec3137177f2e25c6077e6d62c8c5109c935f26654d1a3dc8a2eef.js?body=1:3)
    at HTMLDocument.J (jquery.self-0c1f22fd006ec3137177f2e25c6077e6d62c8c5109c935f26654d1a3dc8a2eef.js?body=1:3)

我创建了一个新的 HTML 页面并尝试添加文档中指定的所有 JS 文件,但我仍然遇到相同的错误。查看页面源码中可以看到所有指定的JS文件都加载了。

<html>
    <head>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
        <script src="https://unpkg.com/leaflet@1.3.1/dist/leaflet.js"></script>
        <script src="js/main.js"></script>
        <script src="https://unpkg.com/plotty@0.2.0/src/plotty.js"></script>
        <script src="js/geotiff.js"></script>
        <script src="js/leaflet-geotiff-plotty.js"></script>
        <script>
            $(document).ready(function(){
              var layer = L.leafletGeotiff("https://stuartmatthews.github.io/leaflet-geotiff/tif/wind_speed.tif",{renderer: null})
            });
        </script>
    </head>
    <body>      
    </body>
</html>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)