Question

Move to local coordinate system

  • 12 September 2019
  • 13 replies
  • 62 views

Userlevel 4
Badge +26

Hi All, we do a lot with 3D models here with FME and one pretty common task for us is moving data from real world coordinates to a local/relative coordinate system.

 

 

It looks like FME has several ways to do this, however, none seem to be the ideal approach.

 

 

1. Use the writers built-in 'move to local coordinate system'

 

- Handy, however, the whole model is 'normalised' / scaled so that it fits into a 1*1 space meaning that a custom scaling must be applied in external application to have it scaled correctly

2. Use models Center Point with Offsetter to move to center origin

- Keeps scale and rotation, however, instead of offsetting the geometry it applies a TransformationMatrix. This is great in some cases, however, several formats (e.g., 3DS) can't handle the big original coordinates and so precision after the transformation is lost.

3. Use the CommonLocalReprojector

- So far I've found this to produce the best results, however, it requires that the input data have a coordinate system or else it wont work. Many 3D formats and most CAD can be in real world coordinates, however, the coordinate systems is not stored and picked up by FME meaning this can't be used

 

 

Has anyone found a robust method for moving to a local coordinate system while preserving the scale/rotation?

13 replies

Userlevel 2
Badge +19

Is the SystemCoordinateSetter transformer a possibility to set the coordiante system of the input data for the third method?

Userlevel 4
Badge +26

Is the SystemCoordinateSetter transformer a possibility to set the coordiante system of the input data for the third method?

Ah yes for sure, however, this requires the process to know the coordinate somehow. In most cases yes that would work, even a user parameter, however, I want to be able to make it general and automated.

Badge +1

When I need to write to FBX, which also requires a local coordinate system, I use an Affiner.

The C and F values are calculated from the centerpoint of the bounding box.

There is also a 3dAffiner, which is able to handle rotation and scaling, but for me the Affiner works great.

Also make sure the Coordinate System is set to *XY-MT* (meters) or *XY-FT* (feet) in your writer.

Badge +21

Using the 3DAffiner and the GeometryRefiner before/after to "normalise" the geometry.

Userlevel 4
Badge +26

When I need to write to FBX, which also requires a local coordinate system, I use an Affiner.

The C and F values are calculated from the centerpoint of the bounding box.

There is also a 3dAffiner, which is able to handle rotation and scaling, but for me the Affiner works great.

Also make sure the Coordinate System is set to *XY-MT* (meters) or *XY-FT* (feet) in your writer.

Thanks for the suggestion - this would be a good option, however, as with the offsetter it just applies a TransformationMatrix to the data. The issue is the same with point two.

Userlevel 4
Badge +26

Using the 3DAffiner and the GeometryRefiner before/after to "normalise" the geometry.

Thanks @sigtill, it seems that depending on the output format and geometry the matrix will still be there. If a Solid of Mesh then there is no Matrix, however, if Surfaces then matrix exists.

 

Perhaps I need to look into trying to make everything a mesh.
Userlevel 2
Badge +17

Hi @virtualcitymatt,

After you use the Offsetter, add a CsmapReprojector to reproject from LL84 to LL83. This is a null datum shift, so will not move the data, but it will apply the transformation matrix to the feature coordinates for you.

Userlevel 2
Badge +17

Hi @virtualcitymatt,

After you use the Offsetter, add a CsmapReprojector to reproject from LL84 to LL83. This is a null datum shift, so will not move the data, but it will apply the transformation matrix to the feature coordinates for you.

If your coordinate values are still high after the offset, you may want to try UTM84-10N to UTM83-10 instead - this deals with higher coordinate values better.

Userlevel 4
Badge +26

If your coordinate values are still high after the offset, you may want to try UTM84-10N to UTM83-10 instead - this deals with higher coordinate values better.

This is a great tip. I'll be sure to test this one out. Thanks Dave!

Userlevel 2
Badge +17

Hi @virtualcitymatt,

We dug into the writer code a bit and found that we could move to local without scaling the coordinates by adding a line to the workspace header:

<keyname>_LOCAL_COORDSYS_TRANSFORMATION OFFSET_CENTROID_TO_ORIGIN

where <keyname> is the writer keyname (ie. OBJ_1).

Set Move to Local Coordinate System to Yes, then add this line, and you should get the results you want in the output file, with no need for the reprojection.

I have created an enhancement request to make this the default behavior, rather than scaling.

Userlevel 4
Badge +26

Hi @virtualcitymatt,

We dug into the writer code a bit and found that we could move to local without scaling the coordinates by adding a line to the workspace header:

<keyname>_LOCAL_COORDSYS_TRANSFORMATION OFFSET_CENTROID_TO_ORIGIN

where <keyname> is the writer keyname (ie. OBJ_1).

Set Move to Local Coordinate System to Yes, then add this line, and you should get the results you want in the output file, with no need for the reprojection.

I have created an enhancement request to make this the default behavior, rather than scaling.

Ha! nice one Dave. Thanks a bunch for this! This is great news

Userlevel 4
Badge +26

Ha! nice one Dave. Thanks a bunch for this! This is great news

Hmm, will this work @daveatsafe - if my writer is in a FeatureWriter? The <keyname> is missing for the feature writer and I'm not sure how I would configure this.

Userlevel 2
Badge +17

Hmm, will this work @daveatsafe - if my writer is in a FeatureWriter? The <keyname> is missing for the feature writer and I'm not sure how I would configure this.

I don't think it can be done in the FeatureWriter, since the writer params are all WWJD encoded and stored in the transformer itself, which will write over any changes you make as soon as you save the file.

Reply