src/ol/format/WKT.js
function encode(geom) {
  let type = geom.getType();
  const geometryEncoder = GeometryEncoder[type];
  const enc = geometryEncoder(geom);
  type = type.toUpperCase();
  if (typeof /** @type {?} */ (geom).getFlatCoordinates === 'function') {
    const dimInfo = encodeGeometryLayout(/** @type {import("../geom/SimpleGeometry.js").default} */ (geom));
    if (dimInfo.length > 0) {
      type += ' ' + dimInfo;
    }
  }
  if (enc.length === 0) {
    return type + ' ' + EMPTY;
  }
  return type + '(' + enc + ')';
}
function encode(geom) {
  let type = geom.getType();
  const geometryEncoder = GeometryEncoder[type];
  const enc = geometryEncoder(geom);
  type = type.toUpperCase();
  if (typeof /** @type {?} */ (geom).getFlatCoordinates === 'function') {
    const dimInfo = encodeGeometryLayout(/** @type {import("../geom/SimpleGeometry.js").default} */ (geom));
    if (dimInfo.length > 0) {
      type += ' ' + dimInfo;
    }
  }
  if (enc.length === 0) {
    return type + ' ' + EMPTY;
  }
  return type + '(' + enc + ')';
}
function encode ( geom ) { let type = geom . getType ( ) ; const geometryEncoder = GeometryEncoder [ type ] ; const enc = geometryEncoder ( geom ) ; type = type . toUpperCase ( ) ; if ( typeof /** @type {?} */ ( geom ) . getFlatCoordinates === 'function' ) { const dimInfo = encodeGeometryLayout ( /** @type {import("../geom/SimpleGeometry.js").default} */ ( geom ) ) ; if ( dimInfo . length > 0 ) { type += ' ' + dimInfo ; } } if ( enc . length === 0 ) { return type + ' ' + EMPTY ; } return type + '(' + enc + ')' ; }
Encode a geometry as WKT.
@param {!import("../geom/Geometry.js").default} geom The geometry to encode.
@return {string} WKT string for the geometry.
Encode a geometry as WKT .