GeoJSON形式のデータを地図上に描画するクラスです。
※)shape.jsが必要です。
※)別途、プラグインをインクルードする必要があります。こちらから取得して下さい。
※)2021/03現在、Webメルカトルとの組み合わせには対応していません。
| 引数 | プロパティ | タイプ | デフォルト | 説明 |
| map | - | ZDC.Map | - | 表示する地図を指定 |
| geom | - | GeoJSON | - | GeoJSON形式のオブジェクト |
| options | markerVisible | boolean | true | falseの場合、ZDC.Markerを表示しない |
| markerOptions | object | - | ZDC.Markerのoptions | |
| polylineVisible | boolean | true | falseの場合、ZDC.Polylineを表示しない | |
| polylineOptions | object | - | ZDC.Polylineのoptions | |
| datum | string | TOKYO | 地図に重畳するオブジェクトの測地系を指定 | |
| func | function | - | 全データ取込み後のコールバックメソッド。引数に下記の結果オブジェクトをとる |
結果オブジェクト
※結果オブジェクトは配列で返却されます
| プロパティ | タイプ | 説明 |
| feature | object | GeoJSONのフィーチャーオブジェクト |
| mwidgets | array(ZDC.Marker, ZDC.Polyline) |
ZDC.Markerが含まれるのはoptionsのmarkerVisibleがtrueの場合 ZDC.Polylineが含まれるのはoptionsのpolylineVisibleがtrueの場合 |
引数のgeomと、コールバック関数で取得できる結果オブジェクトの例(optionsのmarkerVisible、polylineVisibleがtrueの場合)
引数のgeom例)
{"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {"name": "Markerサンプル"},
"geometry": {
"type": "MultiPoint",
"coordinates": [
[139.74246740341187, 35.625733117094484],
[139.7386908531189, 35.62852373042681]
]
}
},
{
"type": "Feature",
"properties": {"name": "Polylineサンプル"},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[139.7403645515442, 35.628419084184706],
[139.73946332931519, 35.62545405040402],
[139.74021434783936, 35.62426800610301],
[139.74495649337769, 35.62536684186348],
[139.7447419166565, 35.62810514463655],
[139.7403645515442, 35.628419084184706]
]
]
}
}
]}
結果オブジェクトの例)
[{"feature": {
"type": "Feature",
"properties": {"name": "Markerサンプル"},
"geometry": {
"type": "MultiPoint",
"coordinates": [
[139.74246740341187, 35.625733117094484],
[139.7386908531189, 35.62852373042681]
]
}
},
"mwidgets": [...] // 2つのマーカオブジェクト
},
{"feature": {
"type": "Feature",
"properties": {"name": "Polylineサンプル"},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[139.7403645515442, 35.628419084184706],
[139.73946332931519, 35.62545405040402],
[139.74021434783936, 35.62426800610301],
[139.74495649337769, 35.62536684186348],
[139.7447419166565, 35.62810514463655],
[139.7403645515442, 35.628419084184706]
]
]
}
},
"mwidgets": [...] // 1つのポリラインオブジェクト
}]
| ジオメトリオブジェクト | 対応するAPIのクラス | 説明 |
| Point MultiPoint |
ZDC.Marker | optionsのmarkerVisibleがtrueの場合 |
| LineString MultiLineString Polygon (※) MultiPolygon (※) |
ZDC.Polyline | optionsのpolylineVisibleがtrueの場合 |
※ 穴あきポリゴンの場合、包含されるポリゴンは切り抜かれず、別のZDC.Polylineが重畳されます。