Skip to main content
Question

Move to local coordinate system


virtualcitymatt
Celebrity
Forum|alt.badge.img+35

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

oscard
Influencer
Forum|alt.badge.img+21
  • Influencer
  • September 12, 2019

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


virtualcitymatt
Celebrity
Forum|alt.badge.img+35
oscard wrote:

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.


bertmeskens
Forum|alt.badge.img+2

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.


sigtill
Supporter
Forum|alt.badge.img+24
  • Supporter
  • September 12, 2019

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


virtualcitymatt
Celebrity
Forum|alt.badge.img+35
bertmeskens wrote:

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.


virtualcitymatt
Celebrity
Forum|alt.badge.img+35
sigtill wrote:

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.

daveatsafe
Safer
Forum|alt.badge.img+19
  • Safer
  • September 12, 2019

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.


daveatsafe
Safer
Forum|alt.badge.img+19
  • Safer
  • September 12, 2019
daveatsafe wrote:

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.


virtualcitymatt
Celebrity
Forum|alt.badge.img+35
daveatsafe wrote:

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!


daveatsafe
Safer
Forum|alt.badge.img+19
  • Safer
  • September 12, 2019

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.


virtualcitymatt
Celebrity
Forum|alt.badge.img+35
daveatsafe wrote:

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


virtualcitymatt
Celebrity
Forum|alt.badge.img+35
virtualcitymatt wrote:

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.


daveatsafe
Safer
Forum|alt.badge.img+19
  • Safer
  • October 23, 2019
virtualcitymatt wrote:

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.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings