writeFeatureObject(feature, options) {
    options = this.adaptOptions(options);
    const object = {};
    if (!feature.hasProperties()) {
      object['attributes'] = {};
      return object;
    }
    const properties = feature.getProperties();
    const geometry = feature.getGeometry();
    if (geometry) {
      object['geometry'] = writeGeometry(geometry, options);
      const projection =
        options && (options.dataProjection || options.featureProjection);
      if (projection) {
        object['geometry']['spatialReference'] =
          /** @type {EsriJSONSpatialReferenceWkid} */ ({
            wkid: Number(getProjection(projection).getCode().split(':').pop()),
          });
      }
      delete properties[feature.getGeometryName()];
    }
    if (!isEmpty(properties)) {
      object['attributes'] = properties;
    } else {
      object['attributes'] = {};
    }
    return object;
  }
Encode a feature as a esriJSON Feature object.

@param {import("../Feature.js").default} feature Feature.
@param {import("./Feature.js").WriteOptions} [options] Write options.
@return {Object} Object.
@api
@override