MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / isGeoJSON

Method isGeoJSON

src/common/format/GeoJSON.js:632–642  ·  view source on GitHub ↗

* @static * @version 12.1.0 * @function GeoJSONFormat.isGeoJSON * @description 判断一个对象是否是合法的 GeoJSON 对象。 * @param {Object} obj - 待判断的对象。 * @returns {boolean} 是否是合法的 GeoJSON 对象。

(obj)

Source from the content-addressed store, hash-verified

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

Callers 3

GeoJSONSpec.jsFile · 0.80
toSuperMapGeometryFunction · 0.80
toSuperMapGeometryFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected