The goal was to create a simple-to-use web form interface for the public to automatically create standard Tax Parcel Maps, the most common map produced by the Colleton County Technology Dept.'s GIS Division. Although the recently deployed Flexviewer Mapping Application has been very popular, we've found that many people aren't fond of learning how to use web applications, particularly individuals who've spent the majority of their days working with paper maps. Additionally, the maps produced with the online application doesn't reflect the standardized format of Tax Maps produced by the Colleton County Technology Dept.'s office.
The idea was to create a simple web form that required nothing more than a parcel number and email address to automatically generate and deliver a PDF Tax Map. By default, the program produces an exact replication the most common map the office produces. However, options to change the map's scale, paper size, and include layers like aerial imagery, zoning, contour lines, tax grids, soils, and\or wetlands were available.
The inital step was to create a server side python program using ESRI's ArcPy to automate the map generation. Other python modules were subsiquently used to expand upon the program, such as generating email's with the map as an attachment and automatically deleting the PDF from disc after successful delivery.
The most difficult part of the project was creating a web interface that could communicate with the server, pass the form inputs as variable parameters for the python program to use, execute the python program, and send a HTTP response back to the web client. That is what I am sharing; the overall program architecture, the key scripts and code blocks needed, and a general overview of necessary web server and IIS settings.
Once an implimented, the possibilities as to how the program can be applied are only limited to the capabilities of HTML forms and python programming. Any form parameters can be passed as variables and any python program can use those variables. Enjoy and good luck.
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Map Automation with HTML Forms & Python
1. Using Python w/ HTML Forms Script Code for…wwwrootTaxMapRequestsMapRequest.html
Overview:
Program Architecture
Vital Scripts & Code Blocks
Important Settings <!DOCTYPE html> Create Set
Purpose:
Pass HTML Form inputs as Variable Parameters <html> <body> HTML Form
Execute a Python script using said Variables
Return HTTP Response to web client Action
Application:
Colleton County wanted to create a public
facing web form with easy to understand & use <form name=”input” action=“www…//cgi-bin/CGI_Program.cgi”, method=”get>
options for clients to configure and produce a
‘standard’ Tax Parcel Map that is automatically
created on Colleton’s web server and delivered Enter Email: <input type=”text” name=”Var1” /><br>
via email attachment to client. Select Choice: <input type=”checkbox” name=”Var2” value=”Choice 1”/><br> Form
<button type=”submit” value=”Submit”> Go to Website</button>
Fields
</form> </body> </html>
1
Execute CGI Script
Map Request
Web Page
IIS Module Process Form.html Tax Map
Form Settings & Form Requests
ISAPICGI Action
Restrictions Directs
*.cgi &*.py
to execute
2 w/ python.exe
Submit Form
Web
Client CGI-BIN
mapping.colleton wwwrootinetpup
IIS 6.1
county.org
Execute with
python.exe
3
Script Code for …wwwrootcgi-binCGI_Program.cgi
Send Email
CGI_Program.cgi
IMAP Mail Run as
Server #!C:Python26ArcGIS10.0python.exe
python
import cgi, cgitb, math Create
cgitb.enable() variables
form = cgi.FieldStorage()
Variable1 = form.getvalue("Var1") from HTML
Variable2 = form.getvalue("Var2") form values
Create Map Pass Variables
Create Email to Python Script
Attach Map
Send Email
Delete Map
Any Python or ArcPy Script can use variables. Execute
Ex. print Variable1 Python
print Variable2
script
Run
print "Content-type:text/htmlrnrn"
print '<html> '
print '<head> '
IIS_IUSRS print '<meta http-equiv="refresh" content="0;url=' Return HTTP
arcgisserver print http://…..org/TaxMapRequests/MapRequest.html
accress
Resources print '" /> ' Response
Production print '<title>Request Submitted, Redirecting...</title> ' Headers
print '</head> '
Mapping
print '<body> ' using print
print '</body> ' Colleton County, SC
Technology Dept.
4 Refresh ClientSend HTTP Response print '</html>'
GIS Division
28 November 2012