* @static * @version 12.1.0 * @function GeoJSONFormat.isGeoJSON * @description 判断一个对象是否是合法的 GeoJSON 对象。 * @param {Object} obj - 待判断的对象。 * @returns {boolean} 是否是合法的 GeoJSON 对象。
(obj)
| 630 | * @returns {boolean} 是否是合法的 GeoJSON 对象。 |
| 631 | */ |
| 632 | static isGeoJSON(obj) { |
| 633 | if (typeof obj !== 'object' || obj === null){ |
| 634 | return false; |
| 635 | } |
| 636 | const validTypes = [ |
| 637 | 'Point', 'MultiPoint', 'LineString', 'MultiLineString', |
| 638 | 'Polygon', 'MultiPolygon', 'GeometryCollection', |
| 639 | 'Feature', 'FeatureCollection' |
| 640 | ]; |
| 641 | return validTypes.includes(obj.type); |
| 642 | } |
| 643 | /** |
| 644 | * @static |
| 645 | * @version 12.1.0 |
no outgoing calls
no test coverage detected