Tuesday, October 30, 2007

Smallworld/FME Configuration Tips and Tricks (part 2)

I recently received a number of questions from a colleague that had recently upgraded to FME 2007 as part of the CST 4.1 upgrade. It seemed to me that the questions and answers were actually a continuation of the original Smallworld/FME Configuration Tips and Tricks so I present them here as "part 2". By the way, there is a growing list of Smallworld/FME FAQs at http://www.fmepedia.com/index.php/Category:GE_Smallworld_Format_FAQ

Question: I previously used the Scale function in my fme files to adjust coordinate values between database units (mm) and coordinate system units (m). The factor would be 0.001 or 1000 depending on if I was exporting or importing.

FACTORY_DEF SWORLD SamplingFactory \
@Scale(0.001) \
I used the Workbench for the first time to create an fmw file for exporting objects. I used the Scale Transformer which appears to work. Is this the right approach or should I create an FME coordinate system that matches our Smallworld database coordinate system? This must be a common problem for Smallworld/FME users.

Answer: I typically create a custom FME coordinate system that matches the Smallworld application coordinate system and then let FME do all the unit conversions. That way you don’t need to mess around with the scale transformer.

Question: Below is code based on the example in your FME presentation. Would it be better to rewrite this to include a loop and to execute the fme command for each table or run it as it is?

_global fme_tics_server
_local current_server

# start the fme_tics_server if not already running
_if (current_server << fme_tics_server.current_server) _is _unset _orif
_not current_server.acp_running?
current_server << fme_tics_server.current_server

# indicate which records to prepare for export
_local vc << gis_program_manager.cached_dataset(:gis).collections
_local export_records << rwo_set.new_from(vc[:table1])

# run the command line FME
_local command << {"\\gis\FME\fme","\\server\mapping\FME\sworld2mapinfo.fmw",
"--PORT_SWORLDSWAF", current_server.port_number.write_string}

Answer: If all of your export collections are processed by the same FMW file (which I see it is; which I also think is a good thing) then I do not see a reason to have to put the code in a loop.

Question: Is there a way to create a log file that can be examined during and/or after the translation? I run the code above and have no feedback whether the translation is running or not.

Answer: Probably the best way to get feedback from FME about the progress of the migration is to modify your FMW file to specify a Log File:

If you want to be more flexible, then Publish the Parameter…

... and then you can modify your Magik code to dynamically set the LOG_FILE value at export time ...
   _local command << {"\\gis\FME\fme","\\server\mapping\FME\sworld2mapinfo.fmw",
"--PORT_SWORLDSWAF", current_server.port_number.write_string,

Question: I could previously export objects with mapped geometries by only specifying the mapped geometry field in the fme file. I found that nothing gets written in the new version unless I add each geometry field into the Workbench. Is this correct?

Answer: You are correct that each mapped geometry must be accounted for in your FMW file. The way you have shown your data features...

... is valid. If you want to make your workspace a bit cleaner-looking, you can use a “merge filter” ...

... and then you can flow all your data from that single “Merged” feature to your transformers ...


mark2atsafe said...

Some great tips here Alfred - especially the custom coordinate system. It's much easier than folk think to create one of these - simply copy an existing example and change the units. The Workbench help system is the best source of assistance if you get stuck.

Robert Smeets said...

Hi Alfred,

I was trying to figure out how to set the log file from the command line in FME and found your blog with the answer!

Thanks a lot, hope you're doing well, many greetings from your former coworker Robert Smeets.