30
CONNECT. TRANSFORM. AUTOMATE. Implementing a simple web application with FME Server Logan Pugh Programmer Analyst, City of Austin Tony Castro GIS Analyst, City of Austin Ben Vanderford GIS Analyst Senior, City of Austin

Implementing a Simple Web Application with FME Server

Embed Size (px)

DESCRIPTION

Presented by Logan Pugh, City of Austin

Citation preview

Page 1: Implementing a Simple Web Application with FME Server

CONNECT. TRANSFORM. AUTOMATE.

Implementing a simple web application with FME ServerLogan PughProgrammer Analyst, City of Austin

Tony CastroGIS Analyst, City of Austin

Ben VanderfordGIS Analyst Senior, City of Austin

Page 2: Implementing a Simple Web Application with FME Server

Who, what, when, where, why and how?

Who: Small GIS shop in a big (and growing) city

What: Provide zoning verifications (among other services) to property owners and developers

When: 50 to 80 requests a month

Where: City of Austin, Texas

Why: Each request used to take 1-2 hours

How: Tedious manual process of verifying zoning, hand-editing a PDF and sending it to customer

Page 3: Implementing a Simple Web Application with FME Server

What is zoning verification?

Zoning in Austin started in 1930s

Zoning verifications started in 1960s

Developers and property owners need zoning verification to get financing for (re)development

Page 4: Implementing a Simple Web Application with FME Server

Old Process was Cumbersome: The Fatigue Factor

Lots of research and keying in values Name of applicant and address Parcel ID Index grid Zoning type, definition and ordinance

Print, sign and mail/fax/hand-deliver letter to sales office for customer pickup

Page 5: Implementing a Simple Web Application with FME Server

Old letter format New letter format

Page 6: Implementing a Simple Web Application with FME Server

The Tipping Point

With an ever-increasing workload and not-so-increasing budget/staffing, we need to increase efficiencies

Our staff time stretched, a new zoning verification process became a high priority

Along comes FME Server: we had a new option!

Page 7: Implementing a Simple Web Application with FME Server

Project Requirements

Accept a parcel number in various formats

Perform zoning info drilldown with complex filtering logic

Allow operator to edit/correct info

Generate PDF with electronic signature automatically

Ability to easily be configured for future changes (new users, jurisdictions, etc.)

Spell checking

Page 8: Implementing a Simple Web Application with FME Server

Challenges

How to automate what is by definition a human-verified process?

How can we own the process but provide access to people outside of our workgroup?

How can we build this without any additional infrastructure?

Page 9: Implementing a Simple Web Application with FME Server

FME Server Data Streaming Service

Serves up the results of workspaces directly

Can be HTML, JSON, PDF, etc.

Result must be a single file

Allows everything to work within the context of a web browser

Page 10: Implementing a Simple Web Application with FME Server

FME Server REST API

Simple protocol for programmatically interacting with FME Server

Uses HTTP requests, e.g. GET, PUT, DELETE

Authentication using simple token service

Tokens are per-user, but can be shared for specific applications

FME REST API Developer Playground: http://fmeserver.com/userweb/sharper/playground/

Page 11: Implementing a Simple Web Application with FME Server

Workspaces

Zoning info drilldown workspace

Given a parcel number and parcel agency, returns the zoning types, ordinances and case numbers intersecting a given parcel

Negative buffer to reduce erroneous results caused by inaccuracies between zoning and parcel data

Filter out non-applicable zoning ordinances

Page 12: Implementing a Simple Web Application with FME Server

Zoning Info Drilldown workspace

Workspaces, cont.

ZoningOrdinanceDateCalculator custom transformer ZoningOrdinanceFilter custom transformer

Page 13: Implementing a Simple Web Application with FME Server

Workspaces, cont.

PDF generation workspace

Given various parameters, produces a complete, signed zoning verification letter in PDF format

CSV to JSON workspaces

Editors

Requestors

Agencies

Page 14: Implementing a Simple Web Application with FME Server

Workspaces, cont.PDFTextBlockCreator custom transformerPDF Builder workspace

PDFRectangleTextCreator custom transformer

PDFImageCreator custom transformer

Page 15: Implementing a Simple Web Application with FME Server

Workspaces, cont.

HTML form builder workspace

Serves up an HTML file that ties everything together

Uses JavaScript (Dojo Toolkit) and the FME Server REST API to request, display, edit, and submit data

Can be pre-populated with data via parameters submitted to FME Server

Page 16: Implementing a Simple Web Application with FME Server

Demo

Page 17: Implementing a Simple Web Application with FME Server

Behind the scenes

Page 18: Implementing a Simple Web Application with FME Server

Key Transformers FeatureReader: Performs queries against any

FME-supported format. The queries can have both a spatial and a nonspatial component.

One query is issued to the FME-supported format for each feature that enters the transformer. The results of the query are then output.

This means workspaces can read data dynamically

One of the most powerful transformers in FME!

Page 19: Implementing a Simple Web Application with FME Server

Key Transformers, cont. PythonCaller: Executes a Python script to

manipulate the feature.Useful when implementing logic too complex to handle with other transformers.

Examples:

Fixed-width word-wrapping, justification and special character escaping for text elements on output PDF

Using regular expressions to replace tokens in HTML file with parameter values

Building SQL expressions and sanitizing user input

Page 20: Implementing a Simple Web Application with FME Server

Key Transformers, cont. JSONTemplater: Populates a JSON document

with FME feature attribute values{ "status" : xs:int(fme:get-attribute("_statuscode")), "message" : fme:get-attribute("_message"), "data" : { "parcel_agency": fme:get-attribute("_PARCEL_AGENCY"), "parcel_id": fme:get-attribute("_PARCEL_ID"), "zoning_ztypes": [fme:get-list-attribute("_ztype_list{}.ZONING_ZTYPE")], "zoning_ordinance_case_numbers": [fme:get-list-attribute("_case_number_list{}.CASE_NUMBER")], "zoning_ordinance_numbers": [fme:get-list-attribute("_ordinance_number_list{}.ZONING_ORDINANCE_NUMBER")] }}

Page 21: Implementing a Simple Web Application with FME Server

Key Transformers, cont.

Page 22: Implementing a Simple Web Application with FME Server

Key Transformers, cont.

{ "status" : xs:int(fme:get-attribute("_statuscode")), "message" : fme:get-attribute("_message"), "data" : { "parcel_agency": fme:get-attribute(“_PARCEL_AGENCY"), "parcel_id": fme:get-attribute("_PARCEL_ID"), "zoning_ztypes": [fme:get-list-attribute("_ztype_list{}.ZONING_ZTYPE")], "zoning_ordinance_case_numbers": [fme:get-list-attribute("_case_number_list{}.CASE_NUMBER")], "zoning_ordinance_numbers": [fme:get-list-attribute("_ordinance_number_list{}.ZONING_ORDINANCE_NUMBER")] }}

Page 23: Implementing a Simple Web Application with FME Server

Key Transformers, cont.

{ "status" : xs:int(fme:get-attribute("_statuscode")), "message" : fme:get-attribute("_message"), "data" : { "parcel_agency": fme:get-attribute("_PARCEL_AGENCY"), "parcel_id": fme:get-attribute("_PARCEL_ID"), "zoning_ztypes": [fme:get-list-attribute("_ztype_list{}.ZONING_ZTYPE")], "zoning_ordinance_case_numbers": [fme:get-list-attribute("_case_number_list{}.CASE_NUMBER")], "zoning_ordinance_numbers": [fme:get-list-attribute("_ordinance_number_list{}.ZONING_ORDINANCE_NUMBER")] }}

Page 24: Implementing a Simple Web Application with FME Server

Configuration

Enterprise applications require configurability

Avoid putting file paths, user names, passwords, etc. directly in FME workspaces

Allows workspaces to be shared with confidence, placed under source control (e.g. Git), and configured externally

Uses simple text-based configuration files

Page 25: Implementing a Simple Web Application with FME Server

Configuration, cont.

FME ServerRepositories

Workspace 1

Workspace 2

Workspace n

dev

SecureNetworkFolders

Workspace 1

Workspace 2

Workspace n

test

Workspace 1

Workspace 2

Workspace n

prod

Page 26: Implementing a Simple Web Application with FME Server

Configuration, cont.

import os, ConfigParser

global config_dict # Make variable accessible to other scripted parametersconfig_dict = None

# Get path to config file located alongside published workspaceconfig_path_file = os.path.join(FME_MacroValues['FME_MF_DIR'], 'config_path.txt')

# Return config key/value pairs as a dictionarywith open(config_path_file, 'r') as f: config_file = f.readline().strip() config_parser = ConfigParser.RawConfigParser() config_parser.read(config_file) config_dict = dict(config_parser.items('config')) return config_file

Use Python scripted parameters to read in configuration data. In first scripted parameter:

Page 27: Implementing a Simple Web Application with FME Server

Configuration, cont.

# Just reference dictionary keys to get config valuesreturn config_dict['fmerest_token']

Subsequent scripted parameters are easy:

Page 28: Implementing a Simple Web Application with FME Server

Conclusions

Reduced processing time from 1-2 hours to ~15 minutes

Ability to email generated PDF to customer, saving on paper use and mailing expenses

Laid groundwork for use by other departments and the public

Demonstrates flexibility of FME Server

Page 29: Implementing a Simple Web Application with FME Server

Future improvements

Make app directly available to public

Tie in with existing zoning profile web application

Accept payments online

Collaboration with external parcel agencies on data alignment for improved accuracy

Page 30: Implementing a Simple Web Application with FME Server

Thank You!

Questions?

For more information: Logan Pugh

[email protected] City of Austin

Related web app available for public: http://www.austintexas.gov/gis/zoningprofile/