Typescript 传单地图不显示GeoJSON数据

Typescript 传单地图不显示GeoJSON数据,typescript,leaflet,powerbi,geojson,Typescript,Leaflet,Powerbi,Geojson,我正在尝试渲染power Bi web中嵌入的传单地图上的一些点。提交给传单的数据采用GeoJSON格式。 当我输入此数据时,一切正常,点正确显示: var someFeatures = { "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": { "type": "Point", "coordinates": [-75, 34

我正在尝试渲染power Bi web中嵌入的传单地图上的一些点。提交给传单的数据采用GeoJSON格式。 当我输入此数据时,一切正常,点正确显示:

var someFeatures = {
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [-75, 34]
      },
      "properties": {
        "name": "Location A"
      }
    }
  ]
}
然后我尝试插入我的数据,这只是一对纬度和经度。 下面是我正在运行的代码片段:

function onEachFeature(feature, layer) {
        var popupContent = "<p>I started out as a GeoJSON " +
            feature.geometry.type + ", but now I'm a Leaflet vector!</p>";

        if (feature.properties && feature.properties.popupContent) {
          popupContent += feature.properties.popupContent;
        }

        layer.bindPopup(popupContent);
      }


      var dat = Visual.converter(options.dataViews[0].table.rows); //just converts the data to lat lon format

      var test = GeoJSON.parse(dat, {Point: ['lat', 'lon']}) 
        L.geoJSON([test], {
        style: function(feature) {
          return feature.properties && feature.properties.style;
        },
        onEachFeature: onEachFeature,
        pointToLayer: function(feature, latlng) {
          return L.circleMarker(latlng, {
            radius: 8,
            fillColor: "#ff7800",
            color: "#000",
            weight: 1,
            opacity: 1,
            fillOpacity: 0.8
          });
        }
      }).addTo(this.map);
功能特性(特性,图层){
var popupContent=“我一开始是一个GeoJSON”+
feature.geometry.type+”,但现在我是传单向量!

”; if(feature.properties&&feature.properties.popupContent){ popupContent+=feature.properties.popupContent; } layer.bindPopup(弹出内容); } var dat=Visual.converter(options.dataViews[0].table.rows)//只需将数据转换为lat-lon格式 var test=GeoJSON.parse(dat,{Point:['lat','lon']}) L.geoJSON([test]{ 风格:功能(特征){ 返回feature.properties&&feature.properties.style; }, onEachFeature:onEachFeature, pointToLayer:功能(特性、latlng){ 返回L.circleMarker(车床{ 半径:8, fillColor:#ff7800“, 颜色:“000”, 体重:1, 不透明度:1, 填充不透明度:0.8 }); } }).addTo(此.map);
我非常确定数据已转换为正确的格式,如开发人员控制台所示:

非常感谢您的帮助,因为我不知道如何解决这个问题


编辑:浏览器控制台输出是变量“test”的内容,该变量的输出为:GeoJSON.parse(dat,{Point:['lat',lon']}),其中“dat”是包含纬度和经度的原始数据。

欢迎使用SO!您显示控制台输出,但不显示生成此输出的代码…例如,您是否记录
dat
test
?您好!谢谢你的洞察力,我只是忘记了那个信息。。。浏览器控制台输出是变量“test”的内容,该变量的输出为:GeoJSON.parse(dat,{Point:['lat',lon']}),其中“dat”是包含纬度和经度的原始数据。您可以编辑问题,使其在问题正文中清晰可见。