Use python
Background In this assignment you will be implementing a portion of a Geographic Information System (GIS). A GIS is a computer system used to organize, categorize, and analyze geographical data in order to produce accurate depiction of the real world. The system uses multiple layers of information to achieve this task. The data layers are split into a grid and represented as a matrix with mrows and n columns where each entry in the matrix contains the type of land at that point on the map. An entry Ay is the throw and th column in our map matrix. We assume that Apo Is the first element in our matrix. The graphic below will assist in Visualizing the process: Transporton Agro Heidel Dom Rew WMA E View Undeveloped and Rew World MAD Figure 1 As seen in the previous example, our GIS utilizes 6 different data layers. We can these layers the map types as they classily regions of different and on our map. Thus, each entry in our map matrix can be one of the 6 map types. . 09 C Markdown As seen in the previous example, our GIS utilizes 6 different data layers. We call these layers the map types as they classify regions of different land on our map. Thus, each entry in our map matrix can be one of the 6 map types. Transportation (T) Agricultural (A) . Residential (R) Commercial (C) Water (W) Undeveloped land (U) Our GIS will store the map information as a list of lists. If we have a list named map, then mapp will store the map type at row.column. Each entry wi contain a string that corresponds to 1 of the possible map types listed above. The list representation of the map in Figure 1 is shown below: A.N.N.A.U','U' U'). "A","A","A", R.R. I'WW.W.W T.TT). t'.'.'.' R.R.R. 'c,'c','U','U','T','R','U','U', t't'.'T. ""","0"], T'R''UU')) One usage of the system is to be able to easily identity whether or not a piece of land (entry in the map matrix) is deemed commercially buildable. A piece of land at Af is deemed commercially buildable if the following conditions hold . The entry at Al has map type U The entry Afts not on the edges of the map (the first and fast rows and columns) The entry Afis not adjacent with an entry of map type R or map type A Note that adjacent entries are entries to the top, bottom, kert, and right of the Current cell Based on the criteria and the map representation of Figure 1, can be seen that Als commercially buildable and Aut not commercially buildable. Please read the requirements below to implement the GIS system! Additional Information When using a 2D list, we can access elements around a specific index. Given the element at location ij we can find the adjacent element within the same row by changing the row index. If we want to access the element to the left of our selected element, we can subtract 1 from the Index. To access the element to the right, we can add 1 to the) index. To access the element in the previous row (above the element), we can subtract 1 from the I Index. To access the element in the next row (below the element), we can add 1 to the Index t]: x= [[1,2,3]. 64,5,6), [7,8,931 11 print (13) print (x1-11051) #above print (1) right Be careful when accessing adjacent elements. If you try to access an element that doesn't exist, you might receive unexpected output, or an error In to print (23) # 2 above - actually around and gives us the element in row (which is the last row) print (x[1] [321) 2 risht- tries to access valuw in column 3 which don't exist NOTE THAT YOU WILL BE MARKED ON MULTIPLE ITEMS IN THIS LAB IN ADDITION TO THE FUNCTIONALITY OF YOUR CODE Variable Names Commenting . General Legibility Reflective Questions Town . General Legibility Reflective Questions Program Requirements (12 Marks) Your GIS system will be comprised of a set of functions used to analyze the information of any given map. In addition, you will be creating a function used to determine whether or not a plece of land is commercially buildable. The requirements of the system are given below. Please ensure that your functions have the EXACT naming as specified! Falure to do so will result in lost marks. 1. Define a function countType(map_date, map_type): map_data: A Nist of Alsts representing the data for a given map, map_type: A string representing a map type (TA'R CW or 'U) Return: An Integer representing the number of times map_type occurs in map_cata. 2. Define a function classifyMap(map data); map data: A ist of its representing the data for a given map. Return: A map classification according to the following rules: . The string Suburban if the number of 'R' cells is greater than 50% of all cells The string Farmland if the number of 'W cells is greater than 50% of all colls . The string Conservation if the number of 'U' cells plus the number of 'W cells is greater than 50% of all cells. . The string City i the number of cells is greater than 50% of all colls and the number of 'U' cells plus the number of 'A' cells is between 10% and 20% of all cells (inclusive) The string Mixed if none of the above criteria are met. (Hint, use your count Type function coupled with the fact that the total colla in mop_cata is given by mn 3. Define a function isolateType(mordata, map_type) map_data: A list of Nota representing the data for a given map map_type: A String representing a map type ('T, AR, CW, or 'U') Rotum. Anwillitonta.rosent meg dat as a matrix.but that are not come with a sin.cantinely 3. Define a function isolateType(map_data, map_type): map_data: A list of Nsts representing the data for a given map. map_type: A string representing a map type (T. 'A',R,'CW or 'U') Return: A new Nist of lists that represent map_data as a matrix but all entries that are not equal to map_type are replaced with a string containing only a space (*) 4. Define a function commercialty Buildable(map_data, map_data. A list of lists representing the data for a given map An integer representing a given row in map_data. . An Integer representing a given column in map_data. Return: True If map_data(407 is commercially buildable, otherwise False. (Refer to the background section to determine what is deemed commercially buildable) Implementation Please define all functions in the cell below : VOUW COMEX Sample Output Uruike the other computing labs that required you to run main to validate your code, these functions can act as stand-alone functonsYou have been provided with some test cases, but you are encouraged to create more to thoroughly test your code Test Plan Develop a test plan for your program. Your test plan should have at least three test cases: one normal case, one boundary case, and one abnormal case. You can test any function but you must test at least two different functions. Please use the following format for your test cases: Function: Input: Output: Excepted Output: Pass/Fail: An example test case is shown below: Function: countType(no data, map.type) Input: map data = (','T','U'.'XI. CR.'T.W.NI. D'U'.'T.X.'YI map_type=U Output: 3 Repected Output: 3 Pass/Faili Pass Implement your testing plan in the cell below! 1. Which functions did you use a nested structure (nested loops, nested conditionals, etc) to implement the requirements? Would it have been possible to Implement them without using a nested structure? Which functions did you not use a nested structure? Would it have been possible to implement them with a nested structure? 2. Suppose we wanted to create an additional map classification called 'Urban City which is indicated by the number of 'R' ceils plus the number of cells being between 60% and 80%. Can we do this? How might this affect our classifyMap() function? 3. How many test cases would you need to confirm that your classifyMap() function correctly identifies a "Farmland" map? Explain what your test cases would be. Background In this assignment you will be implementing a portion of a Geographic Information System (GIS). A GIS is a computer system used to organize, categorize, and analyze geographical data in order to produce accurate depiction of the real world. The system uses multiple layers of information to achieve this task. The data layers are split into a grid and represented as a matrix with mrows and n columns where each entry in the matrix contains the type of land at that point on the map. An entry Ay is the throw and th column in our map matrix. We assume that Apo Is the first element in our matrix. The graphic below will assist in Visualizing the process: Transporton Agro Heidel Dom Rew WMA E View Undeveloped and Rew World MAD Figure 1 As seen in the previous example, our GIS utilizes 6 different data layers. We can these layers the map types as they classily regions of different and on our map. Thus, each entry in our map matrix can be one of the 6 map types. . 09 C Markdown As seen in the previous example, our GIS utilizes 6 different data layers. We call these layers the map types as they classify regions of different land on our map. Thus, each entry in our map matrix can be one of the 6 map types. Transportation (T) Agricultural (A) . Residential (R) Commercial (C) Water (W) Undeveloped land (U) Our GIS will store the map information as a list of lists. If we have a list named map, then mapp will store the map type at row.column. Each entry wi contain a string that corresponds to 1 of the possible map types listed above. The list representation of the map in Figure 1 is shown below: A.N.N.A.U','U' U'). "A","A","A", R.R. I'WW.W.W T.TT). t'.'.'.' R.R.R. 'c,'c','U','U','T','R','U','U', t't'.'T. ""","0"], T'R''UU')) One usage of the system is to be able to easily identity whether or not a piece of land (entry in the map matrix) is deemed commercially buildable. A piece of land at Af is deemed commercially buildable if the following conditions hold . The entry at Al has map type U The entry Afts not on the edges of the map (the first and fast rows and columns) The entry Afis not adjacent with an entry of map type R or map type A Note that adjacent entries are entries to the top, bottom, kert, and right of the Current cell Based on the criteria and the map representation of Figure 1, can be seen that Als commercially buildable and Aut not commercially buildable. Please read the requirements below to implement the GIS system! Additional Information When using a 2D list, we can access elements around a specific index. Given the element at location ij we can find the adjacent element within the same row by changing the row index. If we want to access the element to the left of our selected element, we can subtract 1 from the Index. To access the element to the right, we can add 1 to the) index. To access the element in the previous row (above the element), we can subtract 1 from the I Index. To access the element in the next row (below the element), we can add 1 to the Index t]: x= [[1,2,3]. 64,5,6), [7,8,931 11 print (13) print (x1-11051) #above print (1) right Be careful when accessing adjacent elements. If you try to access an element that doesn't exist, you might receive unexpected output, or an error In to print (23) # 2 above - actually around and gives us the element in row (which is the last row) print (x[1] [321) 2 risht- tries to access valuw in column 3 which don't exist NOTE THAT YOU WILL BE MARKED ON MULTIPLE ITEMS IN THIS LAB IN ADDITION TO THE FUNCTIONALITY OF YOUR CODE Variable Names Commenting . General Legibility Reflective Questions Town . General Legibility Reflective Questions Program Requirements (12 Marks) Your GIS system will be comprised of a set of functions used to analyze the information of any given map. In addition, you will be creating a function used to determine whether or not a plece of land is commercially buildable. The requirements of the system are given below. Please ensure that your functions have the EXACT naming as specified! Falure to do so will result in lost marks. 1. Define a function countType(map_date, map_type): map_data: A Nist of Alsts representing the data for a given map, map_type: A string representing a map type (TA'R CW or 'U) Return: An Integer representing the number of times map_type occurs in map_cata. 2. Define a function classifyMap(map data); map data: A ist of its representing the data for a given map. Return: A map classification according to the following rules: . The string Suburban if the number of 'R' cells is greater than 50% of all cells The string Farmland if the number of 'W cells is greater than 50% of all colls . The string Conservation if the number of 'U' cells plus the number of 'W cells is greater than 50% of all cells. . The string City i the number of cells is greater than 50% of all colls and the number of 'U' cells plus the number of 'A' cells is between 10% and 20% of all cells (inclusive) The string Mixed if none of the above criteria are met. (Hint, use your count Type function coupled with the fact that the total colla in mop_cata is given by mn 3. Define a function isolateType(mordata, map_type) map_data: A list of Nota representing the data for a given map map_type: A String representing a map type ('T, AR, CW, or 'U') Rotum. Anwillitonta.rosent meg dat as a matrix.but that are not come with a sin.cantinely 3. Define a function isolateType(map_data, map_type): map_data: A list of Nsts representing the data for a given map. map_type: A string representing a map type (T. 'A',R,'CW or 'U') Return: A new Nist of lists that represent map_data as a matrix but all entries that are not equal to map_type are replaced with a string containing only a space (*) 4. Define a function commercialty Buildable(map_data, map_data. A list of lists representing the data for a given map An integer representing a given row in map_data. . An Integer representing a given column in map_data. Return: True If map_data(407 is commercially buildable, otherwise False. (Refer to the background section to determine what is deemed commercially buildable) Implementation Please define all functions in the cell below : VOUW COMEX Sample Output Uruike the other computing labs that required you to run main to validate your code, these functions can act as stand-alone functonsYou have been provided with some test cases, but you are encouraged to create more to thoroughly test your code Test Plan Develop a test plan for your program. Your test plan should have at least three test cases: one normal case, one boundary case, and one abnormal case. You can test any function but you must test at least two different functions. Please use the following format for your test cases: Function: Input: Output: Excepted Output: Pass/Fail: An example test case is shown below: Function: countType(no data, map.type) Input: map data = (','T','U'.'XI. CR.'T.W.NI. D'U'.'T.X.'YI map_type=U Output: 3 Repected Output: 3 Pass/Faili Pass Implement your testing plan in the cell below! 1. Which functions did you use a nested structure (nested loops, nested conditionals, etc) to implement the requirements? Would it have been possible to Implement them without using a nested structure? Which functions did you not use a nested structure? Would it have been possible to implement them with a nested structure? 2. Suppose we wanted to create an additional map classification called 'Urban City which is indicated by the number of 'R' ceils plus the number of cells being between 60% and 80%. Can we do this? How might this affect our classifyMap() function? 3. How many test cases would you need to confirm that your classifyMap() function correctly identifies a "Farmland" map? Explain what your test cases would be