fme: not just for etl

31
FME: Not just for ETL Bryan Hall Spatial Software Engineer

Upload: safe-software

Post on 10-Feb-2017

158 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: FME: Not Just for ETL

FME: Not just for ETLBryan HallSpatial Software Engineer

Page 2: FME: Not Just for ETL

Quick Bio

Started with Intergraph MGE and AutoCAD for the USAF.

Developed GIS telecom documentation systems (GIMS, CVC) for the USAF and USMC. Created a remote sensing product for DoS

Working with augmented reality to project utility locations “into” the ground. Continue to support CVC

Intro to Geospatial1990-1996

Contract Work1996-Present Current Work

Page 3: FME: Not Just for ETL

Problem: Client needs AutoCAD drawings but the app produces only PDF’s of technical diagrams.

Page 4: FME: Not Just for ETL

Task: Make projected AutoCAD

engineering drawings from

geodetic spatial data

We all know FME is great for ETL work. But… can it be used to generate engineering drawings including labels and title blocks?

Page 5: FME: Not Just for ETL

Starting point:

Oracle databaseEPSG 4326 datasetPre-made Java-2D based screen drawings

End point:

Autocad 2012 DWG fileLocal projection, usually UTM or State PlaneDistance in Feet or Meters

Page 6: FME: Not Just for ETL

Turn This…

Page 7: FME: Not Just for ETL

Into This…

For print!

Page 8: FME: Not Just for ETL

Hey, it’s not THAT bad…

Page 9: FME: Not Just for ETL

Issue #1 – RotationEngineering drawings typically do not show North as “up”. Instead, the world is rotated around the center of the item of interest so it looks and fits good. However, we will have to rotate EVERYTHING we transform or create around this point

Rotator is perfect for this task

Page 10: FME: Not Just for ETL

Issue #1 – Rotation (cont)

Page 11: FME: Not Just for ETL

Issue #2 – ProjectionAlthough the source data is global and geodetic (EPSG 4326), the target sites are planar and the coordinate projection is unknown to the FME worksheet prior to running. Fortunately, we can pass the projection we want as a command line parameter – and let FME’s awesome projection engine help us place the AutoCAD objects at the right locations.

For this, we use Reprojector

Page 12: FME: Not Just for ETL

Issue #2 – Projection (cont)

Page 13: FME: Not Just for ETL

Issue #3 – ScaleEngineering drawings are scaled to best fit that item with some whitespace for labeling parts, not a set scale. The overall scale IS a given parameter – but isn’t quite right due to page size / font size changes for Java screen fonts VS. AutoCAD page size and fonts (the output target). We have to correct for this as well

For this, we used math with relative offsets to create a scale value

Page 14: FME: Not Just for ETL

Issue #3 – Scale (cont)

Page 15: FME: Not Just for ETL

Issue #4 – ClippingWhen the bounding box of the area to display is computed – we will need to clip everything that extends past this box so that we have clean edges to insert into the diagram

Clipper is our friend here

Page 16: FME: Not Just for ETL

Issue #4 – Clipping (cont)

Page 17: FME: Not Just for ETL

Issue #5 – LabelingIn the application, labels are created for a drawing – but not stored spatially (there are no pre-made leader-line geometries to copy to AutoCAD).

Also, the text for the labels in the Spatial application are generated on-the-fly, so that will need to be fed to FME via a view that calls a package to create them

What͛�s This?

Page 18: FME: Not Just for ETL

Issue #5 – Labeling (cont.)So… just use the FME toolset to create AutoCAD labels on the fly – right?

Unfortunately, there is no native specific labeling toolset that makes AutoCAD labels. Yes there is the MapTextLabeler plugin – but even if we had that, it doesn’t take specific leader coordinates as input.

Time to roll our own…

Page 19: FME: Not Just for ETL

Labeling – Breaking it down…What’s a label consist of?

1. A location on the item it is referencing2. A location where the leader line connects to

the text box3. Text – usually multiline in our case – which

will turn out to cause a big headache

Page 20: FME: Not Just for ETL

Making a Label1. Given the location on item it is

referencing determine which direction the leader line goes so we know which side to put the text on. Does it go from right to left, or left to right?

Page 21: FME: Not Just for ETL

Making a Label (cont)2. Create the leader line

Page 22: FME: Not Just for ETL

Making a Label (cont)3. Since AutoCAD draws multiline text from a center point (not top left or top right), count how many rows of text there are so we can calculate an offset (Python)

Page 23: FME: Not Just for ETL

And… then the title blockEach diagram gets a boilerplate title block (created by the worksheet). This is composed of lines and text to replicate the original AutoCAD drawing look. Each of these lines and fonts has to be rotated and scaled to fit for the drawing location and size. Each item uses a relative position offset for it’s coordinate

Page 24: FME: Not Just for ETL

And… a scale barRight – so where is that transformer tool?

Darn, no such thing seems to exist (yet). Time to make our own from scratch. Here we will go with 1, 10, and 100 Foot graticules depending on the drawing scale.

Page 25: FME: Not Just for ETL

And… a scale bar (cont)

Page 26: FME: Not Just for ETL

You want a legend too?Fine… for each type of item depicted, calculate the relative position, symbol size, and font size

Honestly, once I’d done the rest – this was pretty easy!

Page 27: FME: Not Just for ETL

Can I see it yet?

Page 28: FME: Not Just for ETL

Two – Linked Worksheets

Setup…

…and Run

Page 29: FME: Not Just for ETL

Engineering tags are stored in Oracle workspaces. But to set the workspace for the entire workspace, its name first had to be extracted. So for order of operations, we used linked FME workspaces

WHY?

Page 30: FME: Not Just for ETL

Demonstration Time…

(AKA Murphy Time)

Page 31: FME: Not Just for ETL

Thank you!Bryan HallQuestions – email me at:[email protected]