2016-05-15 12 views
0

複数のポリゴンを持つKMLファイルがあります。しかし、私はGoogleマップ上でそれらのポリゴンを使用したい。マップにkmlレイヤーを追加する以外は、Googleマップでこれらのポリゴンを取得する方法はわかっています。私は、これは私が350のKMLポリゴンジオメトリkmlポリゴンのジオメトリデータをGoogleポリゴン座標に変換する方法

を持って

   var polypoints = [   
       {lat:19.135375992895, lng:73.4651621426548}, 
       {lat:19.136223, lng:73.466679}, 
       {lat:19.134651, lng:73.475435}, 
       {lat:19.123618, lng:73.485494}, 
       {lat:19.129928, lng:73.490183}, 
       {lat:19.129584, lng:73.525777}, 
       {lat:19.127386, lng:73.534734}, 
       {lat:19.118468, lng:73.54187}, 
       {lat:19.140901, lng:73.545559}, 
       {lat:19.148871, lng:73.53763}, 
       {lat:19.146312, lng:73.533552}, 
       {lat:19.156782, lng:73.530371}, 
       {lat:19.159095, lng:73.54211}, 
       {lat:19.17804, lng:73.53518}, 
       {lat:19.175427, lng:73.544162}, 
       {lat:19.185196, lng:73.544325}, 
       {lat:19.183185, lng:73.565055}, 
       {lat:19.188709, lng:73.565395}, 
       {lat:19.192421, lng:73.575895}, 
       {lat:19.188721, lng:73.583836}, 
       {lat:19.19424, lng:73.596896}, 
       {lat:19.193097, lng:73.608924}, 
       {lat:19.1994380820247, lng:73.6099695718475}, 
       {lat:19.21112, lng:73.611896}, 
       {lat:19.216131, lng:73.622976}, 
       {lat:19.205074, lng:73.631254}, 
       {lat:19.218492, lng:73.643544}, 
       {lat:19.240521, lng:73.662225}, 
       {lat:19.238587, lng:73.672536}, 
       {lat:19.242568, lng:73.685665}, 
       {lat:19.251789, lng:73.69392}, 
       {lat:19.26913, lng:73.690388}, 
       {lat:19.291075, lng:73.668081}, 
       {lat:19.302024, lng:73.672406}, 
       {lat:19.304008, lng:73.681705}, 
       {lat:19.310702, lng:73.684406}, 
       {lat:19.324347, lng:73.706757}, 
       {lat:19.335062, lng:73.742001}, 
       {lat:19.335283, lng:73.748165}, 
       {lat:19.323247, lng:73.742947}, 
       {lat:19.330931, lng:73.773929}, 
       {lat:19.341891, lng:73.773059}, 
       {lat:19.336424, lng:73.77772}, 
       {lat:19.337174, lng:73.789155}, 
       {lat:19.33064, lng:73.795471} 
        ]; 
        var poly11 = new google.maps.Polygon({paths: polypoints}); 

マップAPIで使用するには、このように見えるようにしたい、この

  <Polygon> 
      <outerBoundaryIs> 
      <LinearRing> 
      <coordinates> 
      74.217933,21.927974,0.0 74.192401,21.925983,0.0 74.178174,21.9321,0.0 74.164435, 
      21.946759,0.0 74.146569,21.952709,0.0 74.143914,21.947538,0.0 74.132601,21.950536, 
      0.0 74.051588,21.926869,0.0 74.017921,21.906915,0.0 73.940306,21.870938,0.0 73.915448, 
      21.858942,0.0 73.886445,21.854553,0.0 73.872501,21.841586,0.0 73.838791,21.84398,0.0 73.806905, 
      21.836495,0.0 73.795757,21.824716,0.0 73.803676,21.820348,0.0 73.80714,21.809796,0.0 73.820618, 
      21.809518,0.0 73.827683,21.809372,0.0 73.832522,21.800558,0.0 73.826672,21.798208,0.0 73.827101, 
      21.792052,0.0 73.837845,21.789244,0.0 73.829416,21.783746,0.0 73.834614,21.773961,0.0 73.824811, 
      21.765365,0.0 73.825474,21.758233,0.0 73.833825,21.754807,0.0 73.836309,21.746688,0.0 73.854042, 
      21.734175,0.0 73.867046,21.718145,0.0 73.880933,21.715067,0.0 73.890513,21.697823,0.0 73.894875, 
      21.676056,0.0 73.887974,21.65309,0.0 73.860169,21.642183,0.0 73.851173,21.646202,0.0 73.849492, 
      21.638522,0.0 73.8385,21.632985,0.0 73.830138,21.64257,0.0 73.824512,21.639684,0.0 73.814003, 
      21.644056,0.0 73.812068,21.63986,0.0 73.780725,21.628594,0.0 73.781443,21.618331,0.0 73.799974, 
      21.603551,0.0 73.814216,21.600913,0.0 73.834905,21.520264,0.0 73.853244,21.497465,0.0 73.863805, 
      21.497775,0.0 73.872545,21.505354,0.0 73.866347,21.506724,0.0 73.864119,21.512335,0.0 73.876908, 
      21.512107,0.0 73.878389,21.504621,0.0 73.905265,21.515516,0.0 73.904175,21.524316,0.0 73.917731, 
      21.51927,0.0 73.921527,21.525118,0.0 73.927295,21.52499,0.0 73.932321,21.51203,0.0 73.945839, 
      21.516515,0.0 73.951749,21.512152,0.0 73.954664,21.54076,0.0 73.9603,21.541543,0.0 73.966245, 
      21.521829,0.0 73.982393,21.522285,0.0 73.974727,21.534395,0.0 73.974835,21.543543,0.0 73.98301, 
      21.540612,0.0 73.993197,21.543254,0.0 73.997254,21.538695,0.0 74.002372,21.541435,0.0 74.000442, 
      21.545559,0.0 74.005804,21.552619,0.0 74.030314,21.545087,0.0 74.037638,21.550482,0.0 74.036571, 
      21.545508,0.0 74.04362,21.54239,0.0 74.044572,21.548019,0.0 74.047052,21.544556,0.0 74.053833, 
      21.547389,0.0 74.053711,21.5553,0.0 74.053787,21.555772,0.0 74.053811,21.555918,0.0 74.054203, 
      21.55773,0.0 74.054949,21.557767,0.0 74.059521,21.565624,0.0 74.072109,21.568334,0.0 74.060284, 
      21.57961,0.0 74.053196,21.596951,0.0 74.039321,21.599039,0.0 74.035168,21.622388,0.0 74.052703, 
      21.633526,0.0 74.058269,21.62828,0.0 74.068697,21.631812,0.0 74.067451,21.645073,0.0 74.058233, 
      21.655136,0.0 74.064248,21.669534,0.0 74.087031,21.671719,0.0 74.093986,21.661162,0.0 74.10084, 
      21.659678,0.0 74.099919,21.644633,0.0 74.083675,21.629971,0.0 74.09551,21.604941,0.0 74.099564, 
      21.604905,0.0 74.094999,21.621662,0.0 74.105406,21.620227,0.0 74.107536,21.610181,0.0 74.12545, 
      21.628568,0.0 74.111203,21.665116,0.0 74.118144,21.676485,0.0 74.146465,21.665937,0.0 74.156023, 
      21.673993,0.0 74.200822,21.680146,0.0 74.217933,21.685328,0.0 74.231912,21.689561,0.0 74.266462, 
      21.706124,0.0 74.26489,21.697462,0.0 74.272554,21.68755,0.0 74.298756,21.686718,0.0 74.312301, 
      21.699125,0.0 74.326192,21.691602,0.0 74.367473,21.692807,0.0 74.385528,21.726404,0.0 74.467352, 
      21.732436,0.0 74.468378,21.749132,0.0 74.459832,21.774116,0.0 74.462667,21.78612,0.0 74.484092, 
      21.792158,0.0 74.491315,21.779393,0.0 74.501576,21.782545,0.0 74.500208,21.806491,0.0 74.506975, 
      21.817289,0.0 74.513637,21.858936,0.0 74.513663,21.877396,0.0 74.51368,21.889811,0.0 74.522749, 
      21.89911,0.0 74.524199,21.911394,0.0 74.50982,21.919968,0.0 74.512741,21.932346,0.0 74.509109, 
      21.936911,0.0 74.486995,21.943298,0.0 74.490625,21.950687,0.0 74.480305,21.958732,0.0 74.469639, 
      21.96187,0.0 74.457396,21.959208,0.0 74.446213,21.967608,0.0 74.434266,21.999017,0.0 74.452246, 
      22.004736,0.0 74.443634,22.011152,0.0 74.438996,22.021142,0.0 74.443756,22.022793,0.0 74.438797, 
      22.025297,0.0 74.431772,22.03024,0.0 74.387504,22.020222,0.0 74.375784,22.000424,0.0 74.3445, 
      21.974979,0.0 74.307772,21.971813,0.0 74.296481,21.962447,0.0 74.290943,21.942557,0.0 74.281505, 
      21.932913,0.0 74.217933,21.927974,0.0 
      </coordinates> 
      </LinearRing> 
      </outerBoundaryIs> 
      </Polygon> 

のようなKML構造を持つこれらのレコードを解析する方法またはこれらのファイルを変換する

+0

は、なぜこれがdownvotedたのですか?私は実際にこれについて興味があって、ちょうどそれに出くわしました。 – Mastro

+0

ええ、ここで同じです。私は質問を破棄した。 –

答えて

0

ネイティブGooglを使用してKMLをレンダリングするサードパーティのKMLパーサー(geoxml3またはgeoxml-v3など)を使用することもできますe Javascript API v3オブジェクトをマップします。これらのサードパーティのパーサーはXmlHttpRequestのドメイン制限が適用されるため、KMLはウェブページと同じドメインにあるか、プロキシ経由で提供されている必要があります。

example using geoxml3(および関連する質問から、あなたのKML:How to identify placemark id of kml layer from given latitude and longitude is present inside that placemark

関連する問題