リージョン分類
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
リージョン分類子は、オブジェクトの形式と場所を指定します。分類子は、画像の場合は 2 次元の長方形、ドキュメントの場合はテキスト行、動画の場合は時間などになります。リージョンを定義するには、使用するコンテンツのタイプに一致するリージョン分類子を選択します。たとえば、コンテンツがテキストの場合は、txt
または line
のいずれかのリージョン分類子を使用する可能性が高くなります。地域分類子の例については、コメントと返信を管理するをご覧ください。
Google Drive API に含まれるリージョン分類子のリストは次のとおりです。
rect
2 次元画像の長方形。
プロパティ |
説明 |
タイプ |
x |
x 軸上の位置。画像の単位はデフォルトでピクセル、PDF の単位はデフォルトでパーセントです。 |
Double |
y |
y 軸上の位置。画像の単位はデフォルトでピクセル、PDF の単位はデフォルトでパーセントです。 |
Double |
w |
x 軸の長さ。画像の単位はデフォルトでピクセル、PDF の単位はデフォルトでパーセントです。 |
Double |
h |
y 軸の長さ。画像の単位はデフォルトでピクセル、PDF の単位はデフォルトでパーセントです。 |
Double |
mw |
コメントが作成されたときのドキュメントの全幅。これを使用して、x と w を単位なしにします。これらはパーセンテージのように動作できるためです。 |
Double |
mh |
コメントが作成されたときのドキュメントの全高。目的については、上記の mw をご覧ください。 |
Double |
r |
ドキュメントの回転角度。たとえば、画像を時計回りに 90 度回転させると、0,0 の長方形が画像の右上に表示されます。0、90、180、270 のいずれかにする必要があります。 |
Double |
page
PDF、TIFF、またはページのあるその他のドキュメントのページ番号。ページのような要素(スプレッドシート、スライド、レイヤなど)を含むドキュメントに使用します。
プロパティ |
説明 |
タイプ |
p |
ページ番号(0 から始まるインデックス)。 |
Integer |
mp |
このドキュメントのページ数。 |
Integer |
time
動画や時間ディメンションを含むその他のドキュメントの時間。
プロパティ |
説明 |
タイプ |
t |
開始時間。 |
hh:MM:ss.frac 形式の時刻文字列(M = 分、m = ミリ秒。時間と分は省略可) |
d |
期間の長さ。 |
hh:MM:ss:mmm 形式の時刻文字列(M = 分、m = ミリ秒) |
md |
ドキュメントのフルタイムの期間。 |
hh:MM:ss:mmm 形式の時刻文字列(M = 分、m = ミリ秒) |
txt
ドキュメント内のテキストの範囲。
プロパティ |
説明 |
タイプ |
o |
開始オフセット(ファイルの先頭からの文字オフセット)。 |
Integer |
l |
テキスト範囲の長さ。 |
Integer |
ml |
このドキュメントの長さ(文字数)。 |
Integer |
line
テキスト ファイル内の特定の行、または行を含むファイル。
プロパティ |
説明 |
タイプ |
n |
行番号。 |
Integer |
l |
行範囲の長さ。 |
Integer |
ml |
ファイルの最大行数。 |
Integer |
matrix
行列のような構造内の位置。スプレッドシート ドキュメントや、行または列の構造を持つ他のドキュメントの行と列を定義するために使用されます。
プロパティ |
説明 |
タイプ |
c |
列番号。 |
Integer |
r |
行番号。 |
Integer |
w |
列数。 |
Integer |
h |
行数。 |
Integer |
mw |
最大幅。 |
Integer |
mh |
最大高さ。 |
Integer |
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-08-29 UTC。
[null,null,["最終更新日 2025-08-29 UTC。"],[],[],null,["# Region classifiers\n\nA region classifier specifies the format and location for an object. A\nclassifier might be a 2-dimensional rectangle for an image, a line of text in a\ndocument, a time duration in a video, and so on. To define a region, select the\nregion classifier that matches the type of content you're trying to use. For\nexample, if your content is text, you're likely going to use either the `txt`\nor `line` region classifier. To see an example of a region classifier, see\n[Manage comments and\nreplies](https://developers.google.com/workspace/drive/api/guides/manage-comments#define).\n\nThe following is a list of the region classifiers included with the\nGoogle Drive API:\n\n`rect`\n\n: A rectangle in a 2-dimensional image.\n\n | Property | Description | Type |\n |----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------|\n | `x` | Position on the x axis, units default to pixels for images and percent for PDFs. | Double |\n | `y` | Position on the y axis, units default to pixels for images and percent for PDFs. | Double |\n | `w` | Length on the x axis, units default to pixels for images and percent for PDFs. | Double |\n | `h` | Length on the y axis, units default to pixels for images and percent for PDFs. | Double |\n | `mw` | The full width of the document when the comment was made. Use this to make `x` and `w` unitless since they can act like a percentage. | Double |\n | `mh` | The full height of the document when the comment was made. See `mw` above for purpose. | Double |\n | `r` | The degrees of rotation of the document. For example, if an image is rotated 90 degrees clockwise then a rectangle at 0,0 displays in the top right of the image. Should be one of 0, 90, 180, 270. | Double |\n\n`page`\n\n: A page number in a PDF, TIFF, or other document with pages. Use this for documents with page-like elements (such as a spreadsheet, slide, or layer).\n\n | Property | Description | Type |\n |----------|---------------------------------------|---------|\n | `p` | The page number (0-indexed). | Integer |\n | `mp` | The number of pages in this document. | Integer |\n\n`time`\n\n: A duration of time in a video or other document with a time dimension.\n\n | Property | Description | Type |\n |----------|-----------------------------------------|-------------------------------------------------------------------------------------------------------|\n | `t` | The start time. | `hh:MM:ss.frac` formatted time string (where M = minutes, m = millis; hours and minutes are optional) |\n | `d` | The duration of the time range. | `hh:MM:ss:mmm` formatted time string (where M = minutes, m = millis) |\n | `md` | The full-time duration of the document. | `hh:MM:ss:mmm` formatted time string (where M = minutes, m = millis) |\n\n`txt`\n\n: A range of text in a document.\n\n | Property | Description | Type |\n |----------|-------------------------------------------------------------|---------|\n | `o` | Start offset (character offset from the start of the file). | Integer |\n | `l` | The length of the text range. | Integer |\n | `ml` | The length of this document in characters. | Integer |\n\n`line`\n\n: A specific line in a text file or any files with lines in it.\n\n | Property | Description | Type |\n |----------|------------------------------------------|---------|\n | `n` | Line number. | Integer |\n | `l` | The length of the line range. | Integer |\n | `ml` | The maximum number of lines in the file. | Integer |\n\n`matrix`\n\n: A location in a matrix-like structure. Used to define rows and columns in spreadsheet documents, or any other documents that have a row or column structure.\n\n | Property | Description | Type |\n |----------|------------------------|---------|\n | `c` | The column number. | Integer |\n | `r` | The row number. | Integer |\n | `w` | The number of columns. | Integer |\n | `h` | The number of rows. | Integer |\n | `mw` | The maximum width. | Integer |\n | `mh` | The maximum height. | Integer |"]]