Python
Python
Python
CT2735
1. Overview
2. Library
3. Function
5. Carry Forward
00
Overview
This code is designed to analyze spatial data and assess the spatial characteristics of an area. It generates maps to facilitate
01
Overview
This code is designed to analyze spatial data and assess the spatial characteristics of an area. It generates maps to facilitate
02
Overview
This code is designed to analyze spatial data and assess the spatial characteristics of an area. It generates maps to facilitate
03
Library
Different types of libraries used
geopandas:
•Purpose: Geopandas is a Python library used for working with geospatial data. It extends the capabilities of pandas to allow spatial
operations on geometric types.
matplotlib.pyplot:
•Purpose: Matplotlib is a plotting library for Python that produces publication-quality figures in a variety of formats and interactive
environments.
numpy:
•Purpose: NumPy is a fundamental package for scientific computing with Python. It provides support for large, multi-dimensional
arrays and matrices, along with a collection of mathematical functions to operate on these arrays.
pandas:
•Purpose: Pandas is a fast, powerful, and flexible open-source data analysis and manipulation tool built on top of the Python
programming language. It is particularly suited for working with structured data, such as tabular data.
04
Functions
Different types of Functions used
•g.read_file(): Reads a file (e.g., a shapefile) and returns a GeoDataFrame.
•GeoDataFrame.plot(): Plots the GeoDataFrame. Additional parameters can be used to customize the plot.
•plt.subplots(): Creates a figure and a set of subplots.
•plt.show(): Displays the current figure.
•ax.plot(): Plots data on the specified axes. Used for customizing the plot of GeoDataFrames.
•plt.cm.get_cmap(): Retrieves a color map from the registered color maps.
•np.linspace(): Returns evenly spaced numbers over a specified interval.
•np.max(), np.min(), np.std(), np.percentile(), np.median(): Calculate various statistics (maximum, minimum, standard deviation,
percentile, median) for an array.
•np.histogram(): Computes the histogram of a set of data.
•np.array(): Creates an array.
•pd.cut(): Divides the values of a column into bins.
•pd.Series.plot(): Plots a pandas Series (used for plotting the histogram).
•input(): Reads a line from input, converts it to a string, and returns it.
•print(): Outputs text to the console.
05
Code
Input - Output
Input
Output
•The g.read_file function in geopandas is used to read geospatial data files, such as shapefiles, from a specified file path.
06
Code
Input - Output
Input
Output
07
Code
Input - Output
Input
08
Code
Input - Output
Input
09
Code
Input - Output
Output
•Ask for equal interval or any manual input for different ranges
•If you entered Equal intervals, then it will ask for how many equal intervals needed
•If you entered Ranges, then it will ask to add different intervals
10
Code
Input - Output
Input
Output
11
Code
Input - Output
Input
Output
12
Carry forward
Changes required
• Error handling
• Code organization
• Visualization
• User interface
13
Thank you
14