SlideShare a Scribd company logo
1 of 1
Download to read offline
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

More Related Content

Viewers also liked

Django - the first five years
Django - the first five yearsDjango - the first five years
Django - the first five years
Jacob Kaplan-Moss
 
GlassFish, Maven, Cloud e Java EE
GlassFish, Maven, Cloud e Java EEGlassFish, Maven, Cloud e Java EE
GlassFish, Maven, Cloud e Java EE
Bruno Borges
 
mapserver_install_linux
mapserver_install_linuxmapserver_install_linux
mapserver_install_linux
tutorialsruby
 
Curso richfaces 3.3.3 II
Curso richfaces 3.3.3 IICurso richfaces 3.3.3 II
Curso richfaces 3.3.3 II
eclaudioaugusto
 

Viewers also liked (18)

Configuration Manager vNext - What to expect
Configuration Manager vNext - What to expectConfiguration Manager vNext - What to expect
Configuration Manager vNext - What to expect
 
SCWCD : Servlet web applications : CHAP : 3
SCWCD : Servlet web applications : CHAP : 3SCWCD : Servlet web applications : CHAP : 3
SCWCD : Servlet web applications : CHAP : 3
 
What's Next with Government Big Data
What's Next with Government Big Data What's Next with Government Big Data
What's Next with Government Big Data
 
Tomcat Maven Plugin
Tomcat Maven PluginTomcat Maven Plugin
Tomcat Maven Plugin
 
Bitcoin.pg
Bitcoin.pgBitcoin.pg
Bitcoin.pg
 
2013 06-07
2013 06-072013 06-07
2013 06-07
 
Sistem keamanan komputer
Sistem keamanan komputerSistem keamanan komputer
Sistem keamanan komputer
 
FUSE and beyond: bridging filesystems paper by Emmanuel Dreyfus
FUSE and beyond: bridging filesystems paper by Emmanuel DreyfusFUSE and beyond: bridging filesystems paper by Emmanuel Dreyfus
FUSE and beyond: bridging filesystems paper by Emmanuel Dreyfus
 
v_s16 (1)
v_s16 (1)v_s16 (1)
v_s16 (1)
 
Django - the first five years
Django - the first five yearsDjango - the first five years
Django - the first five years
 
Manual web2.0 professores
Manual web2.0 professoresManual web2.0 professores
Manual web2.0 professores
 
Hibernate reference pt-br
Hibernate reference pt-brHibernate reference pt-br
Hibernate reference pt-br
 
GlassFish, Maven, Cloud e Java EE
GlassFish, Maven, Cloud e Java EEGlassFish, Maven, Cloud e Java EE
GlassFish, Maven, Cloud e Java EE
 
Bryan So
Bryan SoBryan So
Bryan So
 
mapserver_install_linux
mapserver_install_linuxmapserver_install_linux
mapserver_install_linux
 
SCWCD : The servlet model : CHAP : 2
SCWCD  : The servlet model : CHAP : 2SCWCD  : The servlet model : CHAP : 2
SCWCD : The servlet model : CHAP : 2
 
Web service overview
Web service overviewWeb service overview
Web service overview
 
Curso richfaces 3.3.3 II
Curso richfaces 3.3.3 IICurso richfaces 3.3.3 II
Curso richfaces 3.3.3 II
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Recently uploaded (20)

AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
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