Skip to content

This is a FME Workbench project that adds an orientation field to a feature layer. The orientation field tells the layout engine if the feature should be printed as portrait or landscape. This project is implemented with FME 2017.

License

Notifications You must be signed in to change notification settings

christad92/PrintOrientation-Controller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PrintOrientation-Controller

This is a FME Workbench project that adds an orientation field to a feature layer. The orientation field tells the layout engine if the feature should be printed as portrait or landscape. This project is implemented with FME 2017.

The traditional way of doing this is to use the script below in the field calculator/ expression interface of QGIS:


Ratio = (x_max($geometry)-x_min($geometry))/(y_max($geometry)-y_min($geometry))
PrintOrientation =
Case
when "Ratio" > 1 then 'Landscape'
when "Ratio" <= 1 then 'Portrait'
end
#This works in QGIS

def calcPrintOrient(Ratio):
       if Ratio > 0:
       Dir = "Landscape"
 else:
       Dir = "Portrait"
       return Dir
calcPrintOrient((!shape.extent.XMax!-!shape.extent.XMin!)-(!shape.extent.YMax!-!shape.extent.YMin!))

Local Setup

For you to use this, I recommend that you use FME 2017 to load the workspace. I have also added a template (.fmwt) which has the test data bundled with it.

What I Did

I have used FME to automate the process of orientation control process by calculating the ratio of the x and y axis of each layer. The result helps in determining if the layer is best presented as a Landscape or Portriat.

With the resulting map, All you need to do as a user will be to set the orientation field in your layout/map engine to the orientation attribute of your layer.

Contact

In case you have any questions or assitance on any thinge related, please contact mevia any of these channels.

About

This is a FME Workbench project that adds an orientation field to a feature layer. The orientation field tells the layout engine if the feature should be printed as portrait or landscape. This project is implemented with FME 2017.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published