2016-03-25 17 views
0

私は郡の地図に都市を追加しようとしています。緯度と経度は、フルサイズの地図(ルーマニアレベル)に集中して表示されますが、郡地図上では間違って表示されます。私は都市の地図または緯度/経度を縮尺すべきだと思うが、わからない。 緯度/経度の都市に従って郡の地図をどのように生成すればよいですか?Amcharts - 地図:カスタムマップ(緯度/経度)の悪い座標(緯度/経度)

コードは以下の通りである:私は解決策を見つけた http://jsfiddle.net/xzAx7/33/

var map; 

AmCharts.ready(function() { 
    map = new AmCharts.AmMap(); 
    map.pathToImages = "http://www.ammap.com/lib/images/"; 
    //map.panEventsEnabled = true; // this line enables pinch-zooming and dragging on touch devices 
    map.balloon.color = "#000000"; 

    var wordlDataProvider = { 
     mapVar: AmCharts.maps.Cluj, 
     getAreasFromMap: true, 
     areas: [ 
      { id: "FR", color: "#4444ff" }, 
      { id: "RU", color: "#4444ff" }, 
      { id: "US", color: "#4444ff" } 
     ], 
     images: [{ 
        title: "ClujNapoca", 
        latitude: 46.85307355, 
        longitude: 23.63327696, 
        type: "circle", 
      color: "red", 
      scale: 0.5 
       }, { 
        title: "Turda", 
        latitude: 46.5745618, 
        longitude: 23.78573862, 
        type: "circle", 
      color: "red", 
      scale: 0.5 
       }] 
    }; 

    map.dataProvider = wordlDataProvider; 

    map.areasSettings = { 
     autoZoom: true, 
     selectedColor: "#CC0000" 
    }; 

    map.write("mapdiv"); 

}); 

答えて

0

。カスタムマップを作成するときは、 "defs"プロパティ(leftLongiitude、...)を定義する必要があります。これはこの記事で指定されています。https://www.amcharts.com/tutorials/creating-custom-maps-for-javascript-ammap/
amChartsの記事では、これらの "defs"プロパティを取得する方法について説明しています。

私はそれが

"defs": { 
    "amcharts:ammap": { 
     "projection":"mercator", 
     "leftLongitude":"22.607117", 
     "topLatitude":"47.363798", 
     "rightLongitude":"24.261932", 
     "bottomLatitude":"46.384241" 
    } 
} 

デモどのように動作するかを理解するために以下のコードを変更しました:http://jsfiddle.net/xzAx7/35/