2015-05-02

AttributeCreator Advanced Attribute Value Handling

AttributeCreatorの高度な属性値処理

The "Multiple Feature Attribute Support" of the AttributeCreator was introduced in FME 2013 SP2, we have been receiving big benefit from that.
The functionality had been called the same name until 2014, maybe the only change during the period would be that the "null support" was added in FME 2014.
AttributeCreatorの"Multiple Feature Attribute Support"(複数フィーチャーの属性サポート)はFME 2013 SP2で導入され、私たちは大きな恩恵を受けてきました。
この機能は2014年までは同じ名前で呼ばれており、おそらく、その間の唯一の変更は、FME 2014で「ナル値のサポート」が追加されたことでしょう。














In FME 2015.0, the functionality itself was not changed basically, although the parameters group name has been changed to "Advanced: Prior/Subsequent Feature Attribute Retrieval".
FME 2015.0では、パラメーターグループ名が"Advanced: Prior/Subsequent Feature Attribute Retrieval"に変わりましたが、基本的には機能そのものに変化はありませんでした。












But there have been a big change in FME 2015.1.
しかし、FME 2015.1で大きな変化がありました。

That is, the "Substitute Missing, Null and Empty by" parameter (called "If Attribute is Missing, Null, or Empty" in the previous version) is now independent from the functionality for accessing prior/subsequent feature attributes.
それは、"Substitue Missing, Null and Empty by"パラメーター(以前は"If Attribute is Missing, Null, or Empty"と呼ばれていた)が、前後のフィーチャー属性にアクセスする機能から独立したことです。













What we can do with that?
これで何ができます?

Maybe a typical use case would be to replace an null, missing or empty attribute with a specific value (Default Value). For example, this setting is effective when you need to treat null or missing as 0 in a math expression.
おそらく典型的なユースケースは、ナル、欠落、空文字列属性をある特定の値(Default Value)に置き換えることでしょう。例えばこの設定は、数式においてナルや欠落を0とみなす必要があるときに効果的です。




















It doesn't stand out, but is a wouderful improvement.
目立たないけれども素晴らしい改良です。

FME 2015.1 build 15479

Read Schema Features with FeatureReader

FeatureReaderでスキーマフィーチャーを読み込む

FME 2015.1 has been released a few days ago.
FME 2015.1が数日前にリリースされました。

In FME 2015.1, a new output port named <Schema> has been added to the FeatureReader transformer. From this port, schema features will be output for each feature type, each feature contains the following attributes as a schema information of a feature type.
FME 2015.1では、FeatureReaderトランスフォーマーに <Schema> という名前の出力ポートが追加されました。このポートからは、フィーチャータイプごとのスキーマフィーチャーが出力され、各フィーチャーはフィーチャータイプのスキーマ情報として次のような属性を持ちます。

attribute{}.name
attribute{}.fme_data_type
attribute{}.native_data_type
fme_feature_type_name
etc.

Since the structure is same as the schema feature read by the Schema (Any Format) reader, it can be used to configure dynamic schema applying the method described in this article.
この構造は Schema (Any Format) リーダーで読み込まれるスキーマフィーチャーと同じなので、次の記事で説明されている方法を応用してダイナミックスキーマを構成するのに使用できます。

Think of a case like this.
- There are many Shape files which are saved in a certain folder.
- Their schemas are unknown when creating the workspace.
- You have to create a new File Geodatabase (*.gdb) and export all Shape features to the gdb.
- The destination schemas should be same as the source schemas.
次のような場合について考えます。
- あるフォルダにたくさんのShapeファイルが保存されている。
- ワークスペースの作成時点でそれらのスキーマは不明。
- 新しいファイルジオデータベース (*.gdb) を作成し、全てのShapeフィーチャーをそのgdbにエクスポートしなければならない。
- 出力先のスキーマはソーススキーマと同じでなければならない。

=====
2015-05-23: oops! It was not essential to merge the schema to data features. Since the Schema feature will be outputted first from the FeatureReader, you can send it directly to the Dynamic writer. Then, the writer can configure the destination schema based on it.
Revised the following.
おっと、データフィーチャーにスキーマをマージすることは必須ではありませんでした。スキーマフィーチャーはFeatureReaderから最初に出力されるので、それを直接ダイナミックライターに送ることができます。ライターはそれに基づいて出力先のスキーマを構成できます。
下記修正。
=====

With the FeatureReader in FME 2015.1, this approach is available.
(1) Get all Shape file paths (*.shp) with a Directory and File Pathnames reader.
(2) Send them to a FeatureReader, select "path_windows" or "path_unix" attribute for the "Dataset" parameter.
(3) Merge schema feature to data features with a FeatureMerger.
Requestor (data feature)  fme_feature_type
Supplier (schema feature)  fme_feature_type_name
(4) (3) Send both the Schema feature and the Data features to a FILEGDB writer with Dyanmic Schema mode. Set "Schema from first feature" to the "Schema Sources" parameter.
FME 2015.1のFeatureReaderでは、次のアプローチが可能です。
(1) Directory and File Pathnames リーダーで全てのShapeファイルパス(*.shp)を取得する。
(2) それらをFeatureReaderに送り、"Dataset"パラメータで"path_windows"または"path_unix"属性を選択する。
(3) FeatureMergerでスキーマフィーチャーをデータフィーチャーに結合する。
Requestor (データフィーチャー)  fme_feature_type
Supplier (スキーマフィーチャー)  fme_feature_type_name
(4) (3) スキーマフィーチャーとデータフィーチャーを両方ともダイナミックスキーマモードのFILEGDBライターに送る。"Schema Sources"パラメーターは"Schema from first feature"(フィーチャータイプごとに最初のフィーチャーのスキーマを使用する)に設定してください。


2015-05-23
Deprecated the left image.
左の図は廃止しました。






There are some changes regarding Feature Types in FME 2015.1. See also this article.
FME 2015.1ではフィーチャータイプに関していくつかの変更があります。次の記事も参照してください。

FME 2015.1 build 15479

2015-04-14

Change of ListExploder Default Behavior

ListExploderのデフォルトの動作の変更

In FME 2015, the "Attribute Accumulation" parameters group has been introduced into several transformers such as FeatureMerger, PointOnAreaOverlayer, ListExploder and so on.
FME 2015では、FeatureMerger、PointOnAreaOverlayer、ListExploderなどいくつかのトランスフォーマーに"Attribute Accumulation"パラメーターグループが導入されました。






















In almost all the transformers having "Attribute Accumulation" group, the behavior with default parameter settings is same as the default behavior of the previous version. They are following the general principle that the backward compatibility should be kept.
"Attribute Accumulation"グループを持つほぼ全てのトランスフォーマーでは、デフォルトのパラメーター設定での動作は以前のバージョンのデフォルトの動作と同じです。これらは後方互換性を保つべきであるという一般原則に従っています。

However, I noticed the ListExploder is not following the principle.
しかし、ListExploderはその原則に従っていないことに気がつきました。

The new ListExploder has these four options depending on the Attribute Accumulation settings.
新しいListExploderには、Attribute Accumulationの設定に応じてこれらの4つのオプションがあります。
Accumulation ModeConflict Resolution
1Merge Incoming ListUse Original(default)
2Merge Incoming ListUse Incoming List
3Prefix Incoming List
4Only Use Incoming List

The 1st option is set by default, but the default behavior of the previous version is equivalent to the 2nd option.
1番目のオプションがデフォルトで設定されていますが、以前のバージョンのデフォルトの動作は2番目のオプションに相当します。

I had discussed about this change with Safe support team.
Safe acknowledges that the default behavior of new ListExploder is different from the previous version. And, according to their explanation, the change has been done intentionally to unify the default behavior of the transformers which have "Attribute Accumulation" parameters group.
この変更についてSafe社のサポートチームと話し合いました。
Safe社も新しいListExploderのデフォルトの動作が以前のバージョンと異なることは認めています。そして、彼らの説明によれば、この変更は、"Attribute Accumulation"パラメーターグループを持つトランスフォーマーのデフォルトの動作を統一するために意図的に行われたということです。

I understand that the change is reasonable, but it might cause a confusion to some users who are familiar with the default behavior of the previous ListExploder.
この変更が合理的であることは理解しますが、以前のListExploderのデフォルトの動作に親しんでいるユーザーに混乱をもたらすかも知れません。

Check the parameters always when you use the ListExploder in FME 2015.
FME 2015でListExploderを使うときは、これらのパラメーターをいつも確認してください。

=====
So, I still think it's better that the Attribute Accumulation group will be shown by default, at least in the ListExploder...
なので、Attribute Accumulationグループはデフォルトで表示された方が良いとまだ思っています。少なくともListExploderでは。。。

2015-04-13

Use Time Positions on Time Line

タイムライン上の時間位置の利用

Summary of this thread.
このスレッドのまとめ。
FME Community Answers > Merge features based on time

Assuming you have two datasets:
- one contains rasters having a datetime attribute,
- another contains GPS points also having a datetime attribute.
The goal is to give each raster the geographic coordinate of a point having smallest time difference from the raster.
二つのデータセットがあるものとします。
- ひとつは日付時刻属性を持つラスターから成り、
- もう一つはやはり日付時刻属性を持つGPSポイントから成る。
目標は、各ラスターに、そのラスターからの時間差が最も小さいポイントの地理座標を与えることです。

Seemingly the solution would be complicated, but you can solve it easily with the NeighborFinder if you replace every geometry with a time position on a time line - i.e. a coordinate (time, 0) on the X axis.
一見、解決策は複雑になりそうですが、ジオメトリをタイムラインにおける時間位置 - つまりX軸上の座標 (時間, 0) に置き換えれば、NeighborFinerを使って簡単に解決できます。

(1) Convert the datetime value to the count of seconds since the epoch, using a DateFormatter (Destination Date Format: %s).
DateFormatter (Destination Date Format: %s) によって日付時刻値をエポックからの秒数に変換します。

(2) Extract the raster data as an attribute by a RasterExtractor, and replace the geometry with a point (X=seconds, Y=0) by a VertexCreator.
RasterExtractorによってラスターデータを属性として抽出し、VertexCreatorによってジオメトリをポイント (X=秒数, Y=0) に置き換えます。

(3) Extract geographic coordinate (x, y) of the GPS points by a CoordinateExtractor, and replace the geometry with a point (X=seconds, Y=0) by a VertexCreator, as well.
CoordinateExtractorによってGPSポイントの地理座標 (x, y) を抽出し、同様にVertexCreratorによってジオメトリをポイント (X=秒数, Y=0) に置き換えます。

Here, the point (X=second, Y=0) represents the time position of a feature on a time line (X-axis).
ここで、ポイント (X=秒数, Y=0) がタイムライン(X軸)上のフィーチャーの時間位置を表します。

(4) Add a NeighborFinder; send the (2) features to the Base port; send the (3) features to the Candidate port. Then, each Matched feature will have the geographic coordinate (x, y) of a GPS point which has smallest time difference.
NeighborFinderを追加し、(2)のフィーチャーをBaseポートに、(3)のフィーチャーをCandidateポートに送ります。すると、Matchedフィーチャー は、時間差が最小のGPSポイントの地理座標 (x, y)を持つことになります。

(5) Finally, restore the original raster of each Matched feature by a RasterReplacer.
最後にRasterReplacerによってMatchedフィーチャーを元のラスターに復元します。

I think you have ever learned about "Number Line" in school. In fact, the time line is not any one other than the Number Line.
Elementary mathematics is also very helpful in some cases.
学校で「数直線」について習ったことがあると思います。実のところ、タイムラインは数直線に他なりません。
初等数学も時にはとても役に立ちます。

2015-04-12

Change Multiple Data Types Simultaneously

複数のデータ型を同時に変更する

FME 2015.1 is coming soon.
FME 2015.1は間もなくリリースされます。

Found a wonderful enhancement of writer feature type in FME 2015.1 beta.
You can change data types of multiple attributes simultaneously.
FME 2015.1ベータでライターフィーチャータイプの素晴らしい機能強化を見つけました。
複数の属性のデータ型を同時に変更することができます。

Select multiple rows with Ctrl+Click.
Ctrlキーを押しながらクリックして複数行を選択。















Change data type of a row in the selection. e.g. char -> number
選択行内のどれかの行でデータ型を変更。例: char -> number















Change width and precision if necessary.
必要に応じて幅と精度も変更。















Quick and intuitive. I have waited for this for long time :)
迅速かつ直感的。長い間これを待っていました(^^)

FME 2015.1 Beta build 15468