<jupyter_start><jupyter_text>Chapter 3 - Session 3 Working with Geometries (Vector Operations) Objectives learn how to write simple code to do vector operations on shapefiles using geopandas library Content 1) Sample Vector Operation (Buffer) 2) Find Air Ports close to Rives (Case Study)   1) Sample Vector Operation (Buffer)There are many common vector operations such as buffer, merge, union, clip, etc.In this section, lets try one example vector operation (buffer to see , we its done in panda library)for more information about vector operations, please check following link<jupyter_code>'''lets first import geopandas library'''

import geopandas as gpd

'''lets read Lao air ports shapefile'''

data = gpd.read_file('.\\data\\LAO_airports.shp')

data.head()
data.plot()
data_buf = data.buffer(1)

data_buf.plot()<jupyter_output><empty_output><jupyter_text>2) Find Air Ports close to Rives (Case Study)<jupyter_code>THA_data = gpd.read_file('.\\data\\THA_adm1.shp')
LAO_data = gpd.read_file('.\\data\\LAO_adm1.shp')

river_data.plot()
airport_data.plot()<jupyter_output><empty_output><jupyter_text>Some common spatial operations can be performed using "geopandas" library's function call "overlay"Following operations are allowed in that function    - intersection    - union    - difference    - etc.    for more information, please check following link    http://geopandas.org/reference/geopandas.overlay.html    in following exercise, we use "union" vector operation to merge 2 administrative shapefiles of Thailand and LaosNote: before we perform "overlay", we have to create GeoDataFrame using geometry information (as in following example).<jupyter_code>'''lets first creat GeoDataFrame s for THA and LAO administrative shapefiles'''
df1 = gpd.GeoDataFrame(THA_data, columns=['geometry'])
df2 = gpd.GeoDataFrame(LAO_data, columns=['geometry'])

'''lets perform union operation'''
LAO_THA_data = gpd.overlay(df1, df2, how='union')

LAO_THA_data.plot()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.0958354239839438, 'fraction_numerical': 0.007024586051179127, 'mean_word_length': 5.759322033898305, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '579986', 'license': 'CC0-1.0', 'n_tokens_mistral': 616, 'n_tokens_neox': 594, 'n_words': 205, 'path': 'Chapter 3/C3S3 - Working with Geometries (Vector Operations).ipynb', 'repo_name': 'saiplanner/python-for-geospatial-data-analysis', 'size': '1993'}