如何关联Leaflet中的两个表

时间:2017-12-12 10:25:34

标签: database leaflet

我正在映射Mars的书目信息,并希望在Leaflet中关联两个表(键列:feature_ID)。我的目标是在单击geojson表1中的功能时显示csv表2信息窗口的弹出窗口。但是,我不知道如何执行此操作。有谁知道我应该在哪里参考?

$.getJSON("mapdata.geojson",function(hoodData){
  L.geoJson( hoodData  , {
style: function(feature){
  var fillColor,
      number_of_papers = feature.properties.number_of_papers;
  if ( number_of_papers > 80 ) fillColor = "#006837";
  else if ( number_of_papers > 40 ) fillColor = "#31a354";
  else if ( number_of_papers > 20 ) fillColor = "#78c679";
  else if ( number_of_papers > 10 ) fillColor = "#c2e699";
  else if ( number_of_papers > 0 ) fillColor = "#ffffcc";
  else fillColor = "#f7f7f7";  // no data
  return { color: "#999", weight: 1, fillColor: fillColor, fillOpacity: .6 };
},
onEachFeature: function( feature, layer ){
  layer.bindPopup( "<strong>" + feature.properties.Clean_Feature_Name + "</strong><br/>" + "Number of Papers: " + feature.properties.number_of_papers + "<br/>" + "Number of Citing Papers: " + feature.properties.number_of_citing_papers + "<br/>" + "Number of self citations: " + feature.properties.number_of_self_citations + "<br/>" + "Total number of citations: " + feature.properties.total_number_of_citations + "<br/>" + "Number of referred citations: " + feature.properties.total_number_of_refereed_citations )
 }
}  ).addTo(map);

到目前为止我创建的地图:https://shinjjo.github.io/heatmap.html 数据:https://github.com/shinjjo/shinjjo.github.io

表1有地理信息(geojson) enter image description here

表2有出版物信息(csv) 表2 enter image description here

0 个答案:

没有答案