Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Here are the instructions and the expected output. Please write in python and comment along so I understand Program Requirements (12 Marks) Your GIS system

image text in transcribedimage text in transcribedHere are the instructions and the expected output. Please write in python and comment along so I understand

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 piece of land is commercially buildable. The requirements of the system are given below. Please ensure that your functions have the EXACT naming as specified! Failure to do so will result in lost marks. 1. Define a function count_type(map_data, map_type): map_data: A list of lists representing the data for a given map. map_type: A string representing a map type ('T','A','R','C','W', or 'U') Return: An integer representing the number of times map_type occurs in map_data. 2. Define a function classify_map(map_data): map_data: A list of lists 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 'A' cells is greater than 50% of all cells. 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 if the number of 'C' cells is greater than 50% of all cells and the number of 'U' cells plus the number of 'A' cells is between 10% and 20% of all cells (inclusive). The string Mixed none of the above criteria are met. (Hint, use your count_type function coupled with the fact that the total cells in map data is given by m*n) 3. Define a function isolate_type(map_data, map_type): map_data: A list of lists representing the data for a given map. map_type: A string representing a map type ('T', 'A', 'R', 'C', 'W', or 'U') Return: A new list 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 (""). (Hint, review the In-Lab Notebook Nested Loops to Process Lists of Lists demo on how to process 2D lists) 4. Define function commercially_buildable(map_data, i,]): map_data: A list of lists representing the data for a given map. . i: An integer representing a given row in map_data. j: An integer representing a given column in map_data. Return: True if map_data[id] (Aj) is commercially buildable, otherwise False, according to the following rules from our background information: First, ensure that the entry Ai is not at the edge of the map (the first and last rows and columns). If it is, return false. (Hint, you will need to find the amount of rows and columns in the map for this step) Ensure that the entry Aj has map type U, otherwise return False. Ensure the entry Ai is not adjacent with an entry of map type R or map type A. Note that adjacent entries are entries to the top, bottom, left, and right of the current cell. (Hint, review the additional information section for this step) The number of U spaces in MAP = 17 The number of T spaces in MAP2 = 12 MAP Type = Mixed MAP2 Type = City Isolated MAP: U [' ! 1 'U', 'U', 'U', 'U'] 'U', '] ] ] 'U', 'U'] 'U', 'U'] 'U', 'U'] 1 'U', 'U' 1 1 ! I'', ['U', 'U', 'U', 'U', ! ! ! ! 1 Isolated MAP2: T I'', ', 'T', ['T', 'T', 'T', 'T', 'T', 'T' ! 1 ! ! ! 1 '] '] ] '] '] . ! 1 'T', 'T', ! 1 'T', 'T', I'', 'T', Is MAP commercially buildable at (4,2): True Is MAP2 commercially buildable at (2,2): False

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

15-5 How will MIS help my career?

Answered: 1 week ago