次のような XML タグに膨大なリストがあります。
<coor> -123.3858,41.34119,0
-123.3856,41.34109,0
-123.3852,41.34121,0
-123.3848,41.34139,0</coor>
次のように必要です:
new LatLng(-123.3858,41.34119),
new LatLng(-123.3856,41.34109),
new LatLng(-123.3852,41.34121),
new LatLng(-123.3848,41.34139),
google maps v2 android で動作します。
座標で文字列の置換を行ったところ、次のような正しい結果が得られました。
String ll = "),new LatLng(";
coor = coor.replaceAll(",0", ll);
,0 を新しい LatLng(... に置き換えます。大きな文字列の latlng テキストを latlng の場所に変更して、ポリゴンに配置する方法がわかりません。
PolygonOptions perimeteres = new PolygonOptions().add(coor);
これを行う方法はありますか?それとも、それぞれを分離して個別の緯度にする必要がありますか?
編集::::
String[] splitData = coor.split(",0");
for (String eachSplit : splitData) {
if (!eachSplit.endsWith(",0")) {
//Log.e("EACH",eachSplit);
Log.v("e","new LatLon("+eachSplit+");");
}
}
これでだいぶ近づいてきた…