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

Function toGeoJSON

src/leaflet/core/Util.js:34–54  ·  view source on GitHub ↗
(feature)

Source from the content-addressed store, hash-verified

32 * ```
33 */
34 export var toGeoJSON = function (feature) {
35 if (!feature) {
36 return feature;
37 }
38 if (['FeatureCollection', 'Feature', 'Geometry'].indexOf(feature.type) != -1 || feature.coordinates) {
39 return feature;
40 }
41 if (feature.toGeoJSON) {
42 return feature.toGeoJSON();
43 }
44 if (feature instanceof L.LatLngBounds) {
45 return L.rectangle(feature).toGeoJSON();
46 }
47 if (feature instanceof L.Bounds) {
48 return L.rectangle([
49 [feature.getTopLeft().x, feature.getTopLeft().y],
50 [feature.getBottomRight().x, feature.getBottomRight().y]
51 ]).toGeoJSON();
52 }
53 return new GeoJSONFormat().toGeoJSON(feature);
54 };
55
56 /**
57 * @function toSuperMapGeometry

Callers 1

WebMap.jsFile · 0.90

Calls 3

indexOfMethod · 0.80
toGeoJSONMethod · 0.80
getTopLeftMethod · 0.45

Tested by

no test coverage detected