CONNECT. TRANSFORM. AUTOMATE.
LEVERAGING FME WORKBENCH AND PYTHON SCRIPTS TO CREATE STYLIZED OIL AND GAS KMZ DATASETS
MARCO A. TERRAZASGIS ANALYST
FGDB to KMZ
Startup & Shutdown Python Scripts
- FME allows us to run python scripts before and after a translation.
- This is very useful because you can carry out maintenance tasks on your datasets before they are pushed into a different format.
- In this example I will be compacting the FGDB before the translation then call a batch file to clean up the FME’s log after the translation.
Startup Python Script- The following python script “compacts” our main data source, the FGDB.
- A regularly used FGDB should be compacted periodically as the records on the database lose their order and unused space is developed. This affects the reading performance as the file system needs to work harder to catch up.
- ESRI recommends compacting your databases once a month if you delete and add data frequently.* Which is often the case if you perform surveyor pipeline and facility updates.
* © ESRI compacting file and personal geodatabases: http://webhelp.esri.com/arcgisserver/9.3/dotnet/index.htm#geodatabases/compac-1530230024.htm
FME Workbench 2 (Pipelines)
FGDB Reader
Reprojection:NAD27 ->
WGS84
As-Built
Test: PL is Existing (Not Surveyed)
Symbolization(Colors/Styles)
Export all KMLsInto a single KMZ
Test: PL is As-Built (Surveyed)
Test: PL is in Construction
EsriReprojector Transformer
The EsriReprojector transformer reprojects feature coordinates from one coordinate system to another using the Esri reprojection library.*
Don’t forget your
Geographic Transformatio
n!
*© Safe Software EsriReprojector Reference: http://docs.safe.com/fme/html/FME_Transformers/Default.htm#Transformers/esrireprojector.htm
FGDB Projection:NAD_1927_StatePlane_Texas_South_Central_FIPS_4204
Google Earth Projection
Google Earth uses Simple Cylindrical (Plate Carree) projection with a WGS84 datum for its imagery base*
*© 2014 Google Earth Projection: https://support.google.com/earth/answer/148110?hl=en
KMLStyler Transformer
The KMLStyler transformer allows us to create a common symbology for a set of features.*
Color
Icon
Line Style
Label Style
* © Safe Software KMLStyler Reference: http://docs.safe.com/fme/html/FME_Transformers/Default.htm#Transformers/kmlstyler.htm
FME Workbench 1 (All Features)
Well Pads
Offices
Leases
Facilities
Pipelines
Shutdown Python Script- The following python script runs a batch
file named “LogClipper.bat” after the translation is done.
- Once the batch file runs the Python script closes.
- more +94 command: Using the original FME log file “Pipelines.log” it creates a “Pipelines.log.new” file which only shows the logs data from line 95 down to the end of the log.
- Move /y command: Replaces the original log with the new condensed version.
- Notepad opens showing the clipped log containing the feature counts.
LogClipper.bat
Clipped FME Log
LIVE DEMO- Initial Python Script
- FME Workbench 1 & Python Scripts- FME Workbench 2 & Python Scripts
- Batch File & Logs
SHOWCASEFinal Product: KMZ!
References
ESRI compacting file and personal geodatabases: http://webhelp.esri.com/arcgisserver/9.3/dotnet/index.htm#geodatabases/compac-1530230024.htm
Safe Software EsriReprojector Reference: http://docs.safe.com/fme/html/FME_Transformers/Default.htm#Transformers/esrireprojector.htm
Safe Software KMLStyler Reference: http://docs.safe.com/fme/html/FME_Transformers/Default.htm#Transformers/kmlstyler.htm
Google Earth Projection Information: https://support.google.com/earth/answer/148110?hl=en
Thank You!
Questions?
For more information: Marco Terrazas ([email protected]) Talisman Energy USA Inc.