WIND FARM SITE SUITABILITY ANALYSIS IN LAKE ERIE USING WEB-BASED PARTICIPATORY GIS (PGIS) Addisu Mekonnen A Thesis Submitted to the Graduate College of Bowling Green State University in partial fulfillment of the requirements for the degree of MASTER OF SCIENCE May 2014 Committee: Peter Gorsevski, Advisor Kurt Panter Margaret Yacobucci
64
Embed
Addisu Mekonnen Submitted to the Graduate College of ...
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
WIND FARM SITE SUITABILITY ANALYSIS IN LAKE ERIE USING WEB-BASED PARTICIPATORY GIS (PGIS)
Addisu Mekonnen
A Thesis
Submitted to the Graduate College of Bowling Green State University in partial fulfillment of
Alesheikh, A., Helali, H., Behroz, H., 2002. Web GIS: Technologies and its applications. Symposium on Geospatial Theory, Processing and Applications, Ottawa.
American Wind Energy Association (AWEA), 2008. 20% Wind energy by 2030. Accessed November 12, 2012, http://www.nrel.gov/docs/fy08osti/41869.pdf
AWS Truewind, 2010. Great lakes offshore wind power project, Site Screening Study for Potentially Viable Offshore Wind Energy Sites, Albany, NY.
Baisner, A. J., Andersen, J. L., Findsen, A., Granath, S. W., Madsen, K. Ø., 2010. Minimizing Collision Risk between Migrating Raptors and Marine Wind Farms: Development of a Spatial Planning Tool. Environmental Management 46, 801–808.
Balram, S., & Dragićević, S., 2006. Collaborative geographic information systems. Idea Group Publishing. Hershey, PA.
Barton, J., Plume, J., Parolin, B., 2005. Public participation in a spatial decision support system for public housing. Computers, Environment and Urban Systems 29, 630-652.
Beacham, J. L., Jensen, J. R.,Wang, Z., 2009. A feasibility analysis of South Carolina wind resources for electric power generation. Institute for Public Service and Policy Research, University of South Carolina.
Berry, R., Higgs, G., Fry, R., Langford, M., 2011. Web-based GIS approaches to enhance public participation in wind farm planning. Transactions in GIS 15, 147-172.
Blyth-Skyrme, R.E., 2010. Options and opportunities for marine fisheries mitigation associated with windfarms: Summary report for COWRIE contract FISHMITIG09. COWRIE Ltd, c/o Nature Bureau, Newbury, UK.
Boroushaki, S., Malczewski, J., 2010. ParticipatoryGIS: A Web-based collaborative GIS and multicriteria decision analysis. URISA Journal 22, 23-32.
Brown, G., Weber, D., 2013. Using public participation GIS (PPGIS) on the Geoweb to monitor tourism development preferences, Journal of Sustainable Tourism 21,192-211.
Cinderby, S., 1999. Geographic information systems (GIS) for participation: the future of environmental GIS? International Journal of Environment and Pollution 11, 304-315.
Coskun, A. A., & Türker, Y. Ö., 2012. Wind energy and Turkey. Environmental Monitoring and Assessment 184, 1265-1273.
Dvorak, M. J., Archer, C. L., Jacobson, M. Z., 2010. California offshore wind energy potential. Renewable Energy 35, 1244-1254.
Esteban, M. D., Diez, J. J., López, J. S., Negro, V., 2011. Why offshore wind energy? Renewable Energy 36, 444-450.
Firestone, J., Kempton, W., Krueger, A., 2009. Public acceptance of offshore wind power projects in the USA. Wind Energy 12, 183-202.
Emerson P., 2011. The original Borda count and partial voting. Social Choice and Welfare 40, 353-358.
Gorsevski, P.V., Cathcart, S.C., Mirzaei, G., Jamali, M.M., Ye, X., Gomezdelcampo, E. 2013. A group-based spatial decision support system for wind farm site selection in northwest Ohio. Energy Policy 55, 374–385.
Grassi, S., Chokani, N., Abhari, R., 2012. Large scale technical and economical assessment of wind energy potential with a GIS tool: Case study Iowa. Energy Policy 45, 73-85.
Great Lakes Wind Energy Center (GLWEC), 2009. Feasibility study, Final Feasibility Report, Cleveland, Ohio.
Guarnaccia, J., & Kerlinger, P., 2007. Feasibility study of potential avian risk from wind energy development, Western Ohio Lakeshore Region, Lucas, Ottawa, Sandusky, and Erie Counties, Ohio.
Haggett, C., 2011. Understanding public responses to offshore wind power. Energy Policy 39, 503-510.
Helimax Energy Inc. (HEI), 2008. Analysis of future offshore wind farm development in Ontario, Canada.
Herdendorf, C.E., 1992. Lake Erie coastal wetlands: An overview. Journal of Great Lakes Research 18, 533-551.
Holcombe, T. L., Taylor, L. A., Reid, D. F., Warren, J. S., Vincent, P. A., & Herdendorf, C. E., 2003. Revised Lake Erie postglacial lake level history based on new detailed bathymetry. Journal of Great Lakes Research 29, 681-704.
Insua, D.R., Kersten,G.E., Rios, J.,Grima, C., 2008. Towards Decision Support for Participatory Democracy. Information Systems and e-Business Management 6, 161-191.
Intergovernmental Panel on Climate Change (IPCC), 2011. Special report on renewable energy sources and climate change mitigation (SRREN) 11th Session of Working Group III. Abu Dhabi, UAE.
Jankowski, P., 2000. Collaborative spatial decision making in environmental restoration management: An experimental approach. Journal of Hydroinformatics 2, 197-206.
Jankowski, P., Nyerges, T., 2003. Toward a framework for research on geographic information-supported participatory decision-making. URISA Journal 15, 9-17.
Jankowski, P., Stasik, M., 1997. Spatial understanding and decision support system: A prototype for public GIS. Transactions in GIS 2, 73-84.
33
Jankowski, P., Zielinska, A., Swobodzinski, M., 2008. Choice modeler: A web-based spatial multiple criteria evaluation tool. Transactions in GIS 12, 541-561.
Jelokhani-Niaraki, M., Malczewski, J., 2012. A user-centered multicriteria spatial decision analysis model for participatory decision making: An ontology-based approach. Proceedings of global geospatial conference. Québec City, Canada.
Karnatak, H. C., Saran, S., Bhatia, K., Roy, P.S., 2007. Multicriteria spatial decision analysis in web GIS environment. Geoinformatica 11, 407–429.
Kubota, S., Soga, K., Sasaki, Y., Abe, A., 2012. Web GIS-based regional social networking service as participatory GIS. 2 LNEE 157, 313-321.
Kunkel, K. E., Westcott, N. E., Kristovich, D. A. R., 2002. Assessment of potential effects of climate change on heavy lake-effect snowstorms near Lake Erie. Journal of Great Lakes Research, 28, 521-536.
Lake Erie Energy Development Corporation (LEEDCo), 2011. Accessed October 25, 2012, http://www.leedco.org/.
Landry, C. E., Allen, T., Cherry, T., Whitehead, J. C., 2012. Wind turbines and coastal recreation demand. Resource and Energy Economics 34, 93-111.
Leung, D., Yang, Y., 2012. Wind energy development and its environmental impact: A review. Renewable & Sustainable Energy 16, 1031-1039.
Limpo J.R., 2011. Assessment of offshore wind energy in Portuguese shallow waters site selection, technical aspects and financial evaluation. A Master’s Thesis Instituto Superior Técnico, Universidade Técnica de Lisboa. Lisbon, Portugal.
Malczewski, J., 2006. GIS-based multicriteria decision analysis: a survey of the literature, International Journal of Geographical Information Science 20, 703-726
Malczewski, J., 1999. GIS and multicriteria decision analysis, John Wiley and Sons Inc., New York, NY.
Mansourian, A., Taleai, M., Fasihi, A., 2011. A web-based spatial decision support system to enhance public participation in urban planning processes. Journal of Spatial Science 56, 269-282.
Mari, R. , Bottai, L., Busillo, C., Calastrini, F., Gozzini, B., Gualtieri, G., 2011. AGIS-based interactive web decision support system for planning wind farms in Tuscany (Italy). Renewable Energy 36, 754-763.
Meng, Y., Malczewski, J., 2010. Web-PPGIS usability and public engagement: A case study in canmore, alberta, canada. URISA Journal 22(1), 55-64.
Mirhosseini, M., Sharifi, F., Sedaghat, A., 2011. Assessing the wind energy potential locations in province of semnan in Iran. Renewable and Sustainable Energy Reviews 15, 449-459.
Molina-Ruiz, J., Martínez-Sánchez, M. J., Pérez-Sirvent, C., Tudela-Serrano, M. L., García Lorenzo, M. L., 2011. Developing and applying a GIS-assisted approach to evaluate visual impact in wind farms. Renewable Energy 36, 1125-1132.
Munda, G., 2008. Social Multi-criteria Evaluation for a Sustainable Economy, Springer, Berlin, Germany.
Musungu, K. , Motala, S., 2012. Participatory multi-criteria evaluation and GIS: An application in flood risk analysis. FIG Young Surveyors Conference - Workshop 1.2, 6204.
National Renewable Energy Laboratory (NREL), 2010. Large-scale offshore wind power in the United States: Assessment of opportunities and barriers. Accessed August 15, 2012, http://www.nrel.gov/nwtc/.
O'Keeffe, A., Haggett, C., 2012. An investigation into the potential barriers facing the development of offshore wind energy in Scotland: Case study - firth of forth offshore wind farm. Renewable & Sustainable Energy Reviews 16, 3711-3721.
Ohio Audubon Society, 2012. Important Bird Areas (IBA). Accessed August 08, 2012, http://web4.audubon.org/bird/iba/.
Ohio Department of Natural Resources (ODNR), 2012. Offshore wind energy. Accessed December 10, 2012, http://www.ohiodnr.com/LakeErie/WindEnergyRules/tabid/21234/Default.aspx
Omitaomu, O. A., Rose, A. N., Blevins, B. R., Jochem, W. C., Mays, G. T., Belles, R., 2012. Adapting a GIS-based multicriteria decision analysis approach for evaluating new power generating sites. Applied Energy 96, 292-301.
Rambaldi, G., Kyem, P., McCall, M., Weiner D., 2006. Participatory spatial information management and communication in developing countries. EJISDC 25, 1-9.
Ratliff, T. C., 2002. A comparison of Dodgson's method and the Borda count. Economic Theory 20(2), 357-372.
Rinner, C., Keßler, C., Andrulis, S., 2008. The use of web 2.0 concepts to support deliberation in spatial decision-making. Computers, Environment and Urban Systems 32 (5), 386-395.
Saidur, R., Rahim, N. A., Islam, M. R., Solangi, K. H., 2011. Environmental impact of wind energy. Renewable and Sustainable Energy Reviews 15, 2423-2430.
Schillings, C., Wanderer,T., Cameron, L., Wal, J.T., Jacquemin, J., Veum, K., 2012. A decision support system for assessing offshore wind energy potential in the North Sea. Energy Policy 49, 541-551.
Sidlar, C.L., Rinner, C., 2007. Analyzing the usability of an argumentation map as a participatory spatial decision support tool. URISA Journal 19, 47-55.
Snyder, B., Kaiser, M. J., 2009. A comparison of offshore wind power development in Europe and the U.S.: Patterns and drivers of development. Applied Energy 86, 1845-1856.
Sun, A., 2013. Enabling collaborative decision-making in watershed management using cloud-computing services. Environmental Modelling & Software 41, 93-97.
Tang, M. Y., 2006. Design and implementation of a GIS-enabled online discussion forum for participatory planning. The 4th Annual PPGIS Conference, Cleveland State University, Cleveland, Ohio.
Tegou, L., Polatidis, H., Haralambopoulos, D. A., 2010. Environmental management framework for wind farm siting: Methodology and case study. Journal of Environmental Management 91, 2134-2147.
Taranu J., 2009. Building consensus using a collaborative spatial multi-criteria analysis system. M.Sc. Thesis. University of Waterloo.
Trang, N.T., 2004. PGIS’s relevance, applicability and conditions in local rural development: a case study with Village Development Planning in Bach Ma National Park buffer zone, Vietnam. International Institute for Geo-Information Science and Earth Observation. Enschede, The Netherlands.
U.S. Census Bureau, 2010. Accessed October 20, 2012, http://quickfacts.census.gov/qfd/states/39000.html
U. S. Department of Energy (USDOE), 2013. Offshore wind market and economic analysis. Accessed November 25, 2013, http://www1.eere.energy.gov/wind/pdfs/offshore_wind_market_and_economic_analysis_10_2013.pdf
U. S. Department of Energy (USDOE), 2011. National offshore wind strategy: creating an offshore wind energy industry in the United States. Accessed August 25, 2012, http://www1.eere.energy.gov/wind/
U.S. Energy Information Administration (USEIA), 2011. Electric power annual 2010. Accessed September 20, 2012, http://www.eia.gov/cneaf/electricity/epa/epa_sum.html.
Vagiona , D.G., Karanikolas, N.M., 2012. A multicriteria approach to evaluate offshore wind farms sitting in Greece. Global NEST Journal 14, 235-243.
Wang, L., Cheng, Q., 2006. Web-based collaborative decision support services: concept, challenges and application. ISPRS Technical Commission II Symposium, Vienna.
Zarghami, M., 2011. Soft computing of the Borda Count by fuzzy linguistic quantifiers. Applied Soft Computing 11, 1067-1073.
Zhang, Y., Sugumaran, R., McBroom, M., DeGroote, J., Kauten, R. L., Barten, P. K, 2011. Web-based spatial decision support system and watershed management with a case study. International Journal of Geosciences 2, 195-203.
Zhong, T., Young, R. K., Lowry, M., Rutherford, G. S., 2008. A model for public involvement in transportation improvement programming using participatory geographic information systems. Computers, Environment & Urban Systems, 32, 123-133.
37
APPENDIX A: FIGURES
Figure 1. System Architecture
38
Figure 2. Relation between Alternatives and Criteria
39
Figure 3. Location Map of the Study Area
40
Figure 4. Evaluation Criteria (a) Bird Habitat, (b) Fish Habitat, (c) Sport Fishery Effort, (d) Commercial Fishery Effort, (e) Distance from Utilities, (f) Population Density, (g) Distance from Navigable Waterways, and (h) Distance from Shore
41
Figure 5. Home Page of the Prototype PGIS
42
Figure 6. Mapping Tool Interface with Map Contents Dialogue Box and Attribute Table of the Decision Alternatives
43
Figure 7. Interface for the forum
44
Figure 8. Decision Tool Interface
45
Figure 9. Data Flow in the Decision Tool
46
Figure 10. Interface of Score Page
47
Figure 11. Data Flow for Group Score
48
Figure 12. Charts for Total Score and Frequency of Criteria
49
APPENDIX B: TABLES
Table 1. Calculated Scores and Ranks after MCDA is performed
Criterion 1 Criterion 2 … Criterion n Score Rank Site 1 r
11 r
12 … r
1n Score
1 rank
1
Site 2 r21 r21
… r2n
Score2 rank
2
Site 3 r31 r32
… r3n
Score3 rank
3
50
Table 2. Numerical Example of 3 Alternatives and 21 Participants
Ranking Alternatives Points a b c 1
st 8 7 6 2
2nd
0 9 12 1 3
rd 13 5 3 0
Number of Participants 21 21 21
51
APPENDIX C: CODE 1. Code Behind the Voting Interface
Imports Npgsql Imports System Imports System.Data Imports System.Web Public Class vote Inherits System.Web.UI.Page Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click Dim conn As NpgsqlConnection Dim myAdapter As NpgsqlDataAdapter Dim mySqlString As String Dim checkuser As New NpgsqlCommand Dim temp As Integer Dim count As Integer conn = New NpgsqlConnection("Server=localhost;Port=5432;Userid=postgres;Database=wpgis;password=gisstudent") conn.Open() mySqlString = "SELECT count(*) FROM vote1 where username='" + Session("login") + "'" checkuser = New NpgsqlCommand(mySqlString, conn) temp = checkuser.ExecuteScalar() conn.Close() count = 0 For Each ctrl As Control In Panel1.Controls If TypeOf ctrl Is CheckBox Then If CType(ctrl, CheckBox).Checked Then count = count + 1 End If End If Next If count >= 1 Then If temp < 1 Then If ChkB1.Checked Then conn.Open() mySqlString = "INSERT INTO vote1 VALUES ('" + Session("login") + "','" + Label14.Text + " ','" + DDList1.SelectedItem.ToString + " ','" + DDList2.SelectedItem.ToString + " ','" + DDList3.SelectedItem.ToString + " ')" myAdapter = New NpgsqlDataAdapter(mySqlString, conn) myAdapter.SelectCommand.ExecuteNonQuery() conn.Close() End If If ChkB2.Checked Then conn.Open() mySqlString = "INSERT INTO vote1 VALUES ('" + Session("login") + "','" + Label16.Text + " ','" + DDList4.SelectedItem.ToString + " ','" + DDList5.SelectedItem.ToString + " ','" + DDList6.SelectedItem.ToString + " ')" myAdapter = New NpgsqlDataAdapter(mySqlString, conn) myAdapter.SelectCommand.ExecuteNonQuery() conn.Close()
52
End If If ChkB3.Checked Then conn.Open() mySqlString = "INSERT INTO vote1 VALUES ('" + Session("login") + "','" + Label18.Text + " ','" + DDList7.SelectedItem.ToString + " ','" + DDList8.SelectedItem.ToString + " ','" + DDList9.SelectedItem.ToString + " ')" myAdapter = New NpgsqlDataAdapter(mySqlString, conn) myAdapter.SelectCommand.ExecuteNonQuery() conn.Close() End If If ChkB4.Checked Then conn.Open() mySqlString = "INSERT INTO vote1 VALUES ('" + Session("login") + "','" + Label20.Text + " ','" + DDList10.SelectedItem.ToString + " ','" + DDList11.SelectedItem.ToString + " ','" + DDList12.SelectedItem.ToString + " ')" myAdapter = New NpgsqlDataAdapter(mySqlString, conn) myAdapter.SelectCommand.ExecuteNonQuery() conn.Close() End If If ChkB5.Checked Then conn.Open() mySqlString = "INSERT INTO vote1 VALUES ('" + Session("login") + "','" + Label22.Text + " ','" + DDList13.SelectedItem.ToString + " ','" + DDList14.SelectedItem.ToString + " ','" + DDList15.SelectedItem.ToString + " ')" myAdapter = New NpgsqlDataAdapter(mySqlString, conn) myAdapter.SelectCommand.ExecuteNonQuery() conn.Close() End If If ChkB6.Checked Then conn.Open() mySqlString = "INSERT INTO vote1 VALUES ('" + Session("login") + "','" + Label24.Text + " ','" + DDList16.SelectedItem.ToString + " ','" + DDList17.SelectedItem.ToString + " ','" + DDList18.SelectedItem.ToString + " ')" myAdapter = New NpgsqlDataAdapter(mySqlString, conn) myAdapter.SelectCommand.ExecuteNonQuery() conn.Close() End If If ChkB7.Checked Then conn.Open() mySqlString = "INSERT INTO vote1 VALUES ('" + Session("login") + "','" + Label26.Text + " ','" + DDList19.SelectedItem.ToString + " ','" + DDList20.SelectedItem.ToString + " ','" + DDList21.SelectedItem.ToString + " ')" myAdapter = New NpgsqlDataAdapter(mySqlString, conn) myAdapter.SelectCommand.ExecuteNonQuery() conn.Close() End If If ChkB8.Checked Then conn.Open() mySqlString = "INSERT INTO vote1 VALUES ('" + Session("login") + "','" + Label28.Text + " ','" + DDList22.SelectedItem.ToString + " ','" + DDList23.SelectedItem.ToString + " ','" + DDList24.SelectedItem.ToString + " ')"
53
myAdapter = New NpgsqlDataAdapter(mySqlString, conn) myAdapter.SelectCommand.ExecuteNonQuery() conn.Close() conn = Nothing End If Label30.Visible = True Label30.Text = "You have successfully casted your vote!!!" Else MesBox1("This user named " + Session("login") + " had already casted his/her vote. So you cannot vote again!") End If Else MesBox1("Please select at least 1 criteria!!!") End If For Each ctrl As Control In Panel1.Controls If TypeOf ctrl Is CheckBox Then CType(ctrl, CheckBox).Checked = False End If If TypeOf ctrl Is DropDownList Then CType(ctrl, DropDownList).SelectedIndex = 0 End If If TypeOf ctrl Is DropDownList Then CType(ctrl, DropDownList).Enabled = False End If If TypeOf ctrl Is RequiredFieldValidator Then CType(ctrl, RequiredFieldValidator).Enabled = False End If Next End Sub Private Sub LinkButton2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton2.Click Label30.Visible = False End Sub Private Sub MesBox1(ByVal msg As String) Dim lbl As New Label lbl.Text = "<script language='javascript'>" & Environment.NewLine & _ "window.alert('" + msg + "')</script>" Page.Controls.Add(lbl) End Sub End Class
2. Code Behind the Result Interface
Imports System Imports System.Data Imports System.Web Imports Npgsql Imports InfoSoftGlobal Imports Utilities Public Class result Inherits System.Web.UI.Page
54
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim conn As New NpgsqlConnection Dim mysqlstring As String Dim totalvoters As New NpgsqlCommand conn = New NpgsqlConnection("Server=localhost;Port=5432;Userid=postgres;Database=wpgis;password=gisstudent") conn.Open() mysqlstring = "SELECT Count(DISTINCT username) FROM vote1" totalvoters = New NpgsqlCommand(mysqlstring, conn) Label2.Text = totalvoters.ExecuteScalar conn.Close() End Sub Protected Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button2.Click Dim conn As New NpgsqlConnection Dim mysqlstring As String Dim myAdapter As New NpgsqlCommand conn = New NpgsqlConnection("Server=localhost;Port=5432;Userid=postgres;Database=wpgis;password=gisstudent") mysqlstring = "SELECT t7.score1,t6.score2,t6.score3 FROM (SELECT t5.id,t5.score2,t4.score3 FROM (SELECT sum(t3.score) as score3, sum(t3.score)* 0 as id FROM (SELECT t2.total*2 as score,t2.id FROM (SELECT site3 as id, count(site3) as total FROM vote1 GROUP BY site3) t2 WHERE(t2.id = 1)UNION SELECT t2.total*1 as score,t2.id FROM (SELECT site3 as id, count(site3) as total FROM vote1 GROUP BY site3) t2 WHERE t2.id=2 UNION SELECT t2.total*0 as score,t2.id FROM (SELECT site3 as id, count(site3) as total FROM vote1 GROUP BY site3) t2 WHERE t2.id=3) t3)t4 INNER JOIN (SELECT sum(t3.score) as score2, sum(t3.score)* 0 as id FROM ( SELECT t2.total*2 as score,t2.id FROM (SELECT site2 as id, count(site2) as total FROM vote1 GROUP BY site2) t2 WHERE(t2.id = 1) UNION SELECT t2.total*1 as score,t2.id FROM (SELECT site2 as id, count(site2) as total FROM vote1 GROUP BY site2) t2 WHERE t2.id=2 UNION SELECT t2.total*0 as score,t2.id FROM (SELECT site2 as id, count(site2) as total FROM vote1 GROUP BY site2) t2 WHERE t2.id=3) t3)t5 ON t4.id=t5.id)t6 INNER JOIN (SELECT sum(t3.score) as score1, sum(t3.score)* 0 as id FROM (SELECT t2.total*2 as score,t2.id FROM (SELECT site1 as id, count(site1) as total FROM vote1 GROUP BY site1) t2 WHERE(t2.id = 1) UNION SELECT t2.total*1 as score,t2.id FROM (SELECT site1 as id, count(site1) as total FROM vote1 GROUP BY site1) t2 WHERE(t2.id = 2) UNION SELECT t2.total*0 as score,t2.id FROM (SELECT site1 as id, count(site1) as total FROM vote1 GROUP BY site1) t2 WHERE t2.id=3) t3)t7 ON t7.id=t6.id" myAdapter = New NpgsqlCommand(mysqlstring, conn) Dim dr As NpgsqlDataReader conn.Open() dr = myAdapter.ExecuteReader Dim dt As New DataTable dr.Read() txtsite11.Text = dr(0).ToString txtsite22.Text = dr(1).ToString txtsite33.Text = dr(2).ToString
55
Button3.Enabled = True Label3.Visible = True HyperLinkMap.Enabled = True conn.Close() End Sub Protected Sub Button3_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button3.Click Dim conn As New NpgsqlConnection Dim mysqlstring As String Dim myAdapter As New NpgsqlCommand conn = New NpgsqlConnection("Server=localhost;Port=5432;Userid=postgres;Database=wpgis;password=gisstudent") conn.Open() mysqlstring = "UPDATE decision_alternatives SET gscore = CASE site_name WHEN 'Site1' THEN " & txtsite11.Text & " when 'Site2' then " & txtsite22.Text & " when 'Site3' then " & txtsite33.Text & " END WHERE site_name in ('Site1','Site2','Site3');" mysqlstring += "UPDATE decision_alternatives SET grank=t1.rank1 FROM (SELECT gscore, RANK() OVER (ORDER BY gscore DESC) AS rank1 FROM decision_alternatives) t1 WHERE t1.gscore = decision_alternatives.gscore;" myAdapter = New NpgsqlCommand(mysqlstring, conn) myAdapter.ExecuteNonQuery() MesBox1("You have successfully updated both the group score and rank of the decision alternatives on the map!!!") End Sub Private Sub MesBox1(ByVal msg As String) Dim lbl As New Label lbl.Text = "<script language='javascript'>" & Environment.NewLine & _ "window.alert('" + msg + "')</script>" Page.Controls.Add(lbl) End Sub End Class
3. Code Behind the Chart Interface
Imports Npgsql Imports InfoSoftGlobal Imports Utilities Public Class chart Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim mysqlstring As String Dim totalvoters As New NpgsqlCommand 'Database Objects - Initialization Dim conn As New NpgsqlConnection conn = New NpgsqlConnection("Server=localhost;Port=5432;Userid=postgres;Database=wpgis;password=gisstudent") conn.Open()
56
mysqlstring = "SELECT Count(DISTINCT username) FROM vote1" totalvoters = New NpgsqlCommand(mysqlstring, conn) Label5.Text = totalvoters.ExecuteScalar Label7.Text = totalvoters.ExecuteScalar conn.Close() FCLiteral.Text = CreateChart() FCLiteral1.Text = CreateChart1() End Sub Public Function CreateChart() As String 'Database Objects - Initialization Dim conn As NpgsqlConnection conn = New NpgsqlConnection("Server=localhost;Port=5432;Userid=postgres;Database=wpgis;password=gisstudent") 'Dim oRs As DbConn, strQuery As String 'strXML will be used to store the entire XML document generated Dim strXML As String Dim util As New Util() 'Dim strQuery As String Dim cmd As New NpgsqlCommand() 'Generate the graph element strXML = "<graph caption='Sites Output report' subCaption='By Group Score' xAxisName='Site Name' yAxisName='Group Score' decimalPrecision='0' showNames='1' showvalues='0' numberSuffix='' formatNumberScale='0'>" ' SQL Query cmd.CommandText = "select * from decision_alternatives" cmd.Connection = conn conn.Open() ' Open Data Reader Dim oRs As NpgsqlDataReader = cmd.ExecuteReader 'Iterate through each factory While oRs.Read() 'Generate <set name='..' value='..' /> strXML = strXML & "<set name='" & oRs.Item("site_name").ToString() & "' value='" & oRs.Item("gscore").ToString() & "' color='" & util.getFCColor() & "' />" End While ' Close Data Reader oRs.Close() 'Finally, close <graph> element strXML = strXML & "</graph>" 'Create the chart - Column 3D Chart with data from strXML Return FusionCharts.RenderChartHTML("../FusionCharts/FCF_Column3D.swf", "", strXML, "TotalScore", "550", "350", False)
57
End Function Public Function CreateChart1() As String 'Database Objects - Initialization Dim conn As NpgsqlConnection conn = New NpgsqlConnection("Server=localhost;Port=5432;Userid=postgres;Database=wpgis;password=gisstudent") 'Dim oRs As DbConn, strQuery As String 'strXML will be used to store the entire XML document generated Dim strXML As String Dim util As New Util() 'Dim strQuery As String Dim cmd As New NpgsqlCommand() 'Generate the graph element strXML = "<graph caption='Criteria' subCaption='By Total number of voters' xAxisName='Criterion' yAxisName='Number of Voters' decimalPrecision='0' showNames='1' numberSuffix='' formatNumberScale='0'>" ' SQL Query cmd.CommandText = "select criteria, count(criteria) as Total from vote1 group by criteria" cmd.Connection = conn conn.Open() ' Open Data Reader Dim oRs As NpgsqlDataReader = cmd.ExecuteReader 'Iterate through each factory While oRs.Read() 'Generate <set name='..' value='..' /> strXML = strXML & "<set name='" & oRs.Item("criteria").ToString() & "' value='" & oRs.Item("Total").ToString() & "' color='" & util.getFCColor() & "' />" End While ' Close Data Reader oRs.Close() 'Finally, close <graph> element strXML = strXML & "</graph>" 'Create the chart - Column 3D Chart with data from strXML Return FusionCharts.RenderChartHTML("../FusionCharts/FCF_Column2D.swf", "", strXML, "TotalScore", "500", "250", False) End Function End Class