javascript組み込み関数を使用して複数のGeoJSONオブジェクトをマージすることは可能ですか?もしそうでなければ、どうやってこれを飛行で行うことができますか?複数のGeoJSONオブジェクトをjavascriptと組み合わせる
geoJSON1.concat is not a function
を返すJSON(たとえばhere)の提案に従ってgeoJSON1 = geoJSON1.concat(geoJSON2)
を試しました。 GeoJSONはポイント機能であり、有効なGeoJSONオブジェクトです。
これはおそらく答えが「いいえ」の単純な質問ですが、私は決定的な答えを見つけることができませんでした。
例GeoJSONs:
GeoJSON1 = { "type" : "FeatureCollection",
"features" : [
{ "type" : "Feature",
"id" : 1,
"geometry" : {
"type" : "Point",
"coordinates" : ["-119.6165333","34.35935"]},
"properties" : { "video" : "S105SC_Tape13o.noaudio.mpg", "video_second" : "0", "time" : "19:26:58", "date" : "2005-08-26"}
},
{ "type" : "Feature",
"id" : 2,
"geometry" : {
"type" : "Point",
"coordinates" : ["-119.6165167","34.35935"]},
"properties" : { "video" : "S105SC_Tape13o.noaudio.mpg", "video_second" : "2", "time" : "19:27:00", "date" : "2005-08-26"}
}
]
}
GeoJSON2 = { "type" : "FeatureCollection",
"features" : [
{ "type" : "Feature",
"id" : 27,
"geometry" : {
"type" : "Point",
"coordinates" : ["-119.61635","34.3593833"]},
"properties" : { "video" : "S105SC_Tape13o.noaudio.mpg", "video_second" : "55", "time" : "19:27:53", "date" : "2005-08-26"}
},
{ "type" : "Feature",
"id" : 28,
"geometry" : {
"type" : "Point",
"coordinates" : ["-119.6163333","34.3594"]},
"properties" : { "video" : "S105SC_Tape13o.noaudio.mpg", "video_second" : "56", "time" : "19:27:54", "date" : "2005-08-26"}
}
]
}
望ましい結果(原稿のすべての機能を備えた単一にGeoJSON):
newGeoJSON = { "type" : "FeatureCollection",
"features" : [
{ "type" : "Feature",
"id" : 1,
"geometry" : {
"type" : "Point",
"coordinates" : ["-119.6165333","34.35935"]},
"properties" : { "video" : "S105SC_Tape13o.noaudio.mpg", "video_second" : "0", "time" : "19:26:58", "date" : "2005-08-26"}
},
{ "type" : "Feature",
"id" : 2,
"geometry" : {
"type" : "Point",
"coordinates" : ["-119.6165167","34.35935"]},
"properties" : { "video" : "S105SC_Tape13o.noaudio.mpg", "video_second" : "2", "time" : "19:27:00", "date" : "2005-08-26"}
},
{ "type" : "Feature",
"id" : 27,
"geometry" : {
"type" : "Point",
"coordinates" : ["-119.61635","34.3593833"]},
"properties" : { "video" : "S105SC_Tape13o.noaudio.mpg", "video_second" : "55", "time" : "19:27:53", "date" : "2005-08-26"}
},
{ "type" : "Feature",
"id" : 28,
"geometry" : {
"type" : "Point",
"coordinates" : ["-119.6163333","34.3594"]},
"properties" : { "video" : "S105SC_Tape13o.noaudio.mpg", "video_second" : "56", "time" : "19:27:54", "date" : "2005-08-26"}
}
]
}
のhttpを一瞥:にGeoJSONフィールドを備えていますが、配列
concat
方法を使用することができ、または配列です。 //geojson.org/は**オブジェクト** **配列**ではないことを示唆しています。 – Quentin
入力がどのようなものか、希望の出力がどのようなものかの例をいくつか追加できますか? – kristaps
@Quentinなぜ 'concat'メソッドが機能しないのですか? @kristaps入力と結果の簡単な例をいくつか追加しました。 – Bird