| 129 | } |
| 130 | |
| 131 | function _prepareFeatuers(feature) { |
| 132 | const geometry = feature.geometry; |
| 133 | if (!(CommonUtil.isArray(geometry.coordinates))) { |
| 134 | throw "Geometry must have coordinates array: " + geometry; |
| 135 | } |
| 136 | if (!parseCoords[geometry.type.toLowerCase()]) { |
| 137 | throw "Unsupported geometry type: " + geometry.type; |
| 138 | } |
| 139 | try { |
| 140 | geometry.coordinates = parseCoords[geometry.type.toLowerCase()].apply( |
| 141 | this, [geometry.coordinates] |
| 142 | ); |
| 143 | } catch (err) { |
| 144 | throw err; |
| 145 | } |
| 146 | feature.geometry = geometry; |
| 147 | return feature; |
| 148 | } |
| 149 | |
| 150 | function _transformCoordinates(coordinates) { |
| 151 | //判断code 是投影坐标还是地理坐标 |