2017-08-29 7 views
0

こんにちは皆さんはファイルURLの場所を変数に置き換える方法は?ロケーションURLとして変数を使用する方法は?

NgMap.getMap().then(function (map) { 
        $scope.map = map; 
        var myParser = new geoXML3.parser({ map: map }); 
        myParser.parse('cta.kml'); 
       }); 

myParser.parseはURLのみではなく、変数を受け入れていますか?これは可能ですか? myParser.parse(結果)を交換する方法

var result = "<?xml version="1.0" encoding="UTF-8"?> 
<kml xmlns="http://earth.google.com/kml/2.1"> 
<!-- Data derived from: 
     Ed Knittel - || tastypopsicle.com 
     Feel free to use this file for your own purposes. 
     Just leave the comments and credits when doing so. 
--> 
    <Document> 
    <name>Chicago Transit Map</name> 
    <description>Chicago Transit Authority train lines</description> 

    <Style id="blueLine"> 
     <LineStyle> 
     <color>ffff0000</color> 
     <width>4</width> 
     </LineStyle> 
    </Style> 
    <Style id="redLine"> 
     <LineStyle> 
     <color>ff0000ff</color>" ........ so on... 

????

imはngMapを使用しています。

答えて

0

myParser.parseはURLのみを受け入れますが、変数ではありませんか?これは可能ですか?

NgMap.getMap().then(function (map) { 
    $scope.map = map; 
    var myParser = new geoXML3.parser({ map: map }); 
    var myUrl = 'cta.kml'; 
    myParser.parse(myUrl); 
}); 

可能であるべきです。

ただし、それがあなたの質問だったらどうですか?

+0

myParser.parse(結果)どのようにするのですか? 「result」は可変なので –

関連する問題