Graeme - I'm reasonably confident that your hunch will take you in the right direction. If your source file does not have a coordinate system defined on it then when you write to shape, no PRJ will be produced. If the source data knows "where it is", i.e. does have a defined coordsys, then you'll get an output PRJ. That said you can setup a test in your workflow (using Workbench) to have a CoordinateSystemExtractor put each features defined coordinatesystem into an attribute, if this attribute is blank then, assuming you know what coordsys its supposed to be from some other attribute then you can use a Tester to determine which CoordinateSytemSetter your data goes to. If you find a coordinate system that is not correct, then you can in the same way send each feature to a Reprojector to reproject to a common format.
If actually all your source data doesn't have a coordinate system defined, but you know where it is supposed to be then just setting a 'source' coordinate system parameter to the correct value will ensure PRJ files are created on your target.
Hope that helps, Dave
Thanks for the response, Dave. Our assumptions were only partially true, so caution is needed when translating directories of shapefiles with mixes of projection definitions.
Here's a summary of the behaviour I found for mapping file translations based on different WRITER directive settings. I used a single input directory with a mix of shapefiles in different projections, some of which had .prj files, some did not. I suspect that analogous behaviour would occur for workbench translations too.
A) Case of COORDINATE_SYSTEM directive defined in mapping file:
- Output .prj files will ALWAYS be created based on that CS definition.
- Inputs with no .prj file are automatically assumed to be in the defined CS, and are output as such
- Inputs with a .prj different from the CS directive definition will automatically get reprojected for output
B) Case of COORDINATE_SYSTEM directive omitted from mapping file:
- Outputs receive NO .prj FILE UNTIL the first shapefile with a .prj is read in. All outputs created after that file is read then receive a .prj file
- Any .prj files created for output are then BASED ON THE LAST .prj FILE READ IN. This can change during the course of translation if the inputs have a heterogeneous mix of different projection files.
- As a result, inputs with no .prj file are assumed to be in the coordinate system of the last .prj read in. In the future, I think it would make more sense in this case for no .prj file to be created/assumed.
- No automatic reprojection occurs
Hopefully this is useful for others as there is currently no documentation in the FME ESRI Shape Writer sections that even mention .prj files.