NEW
Font size
WorksheetsGeospatial Python libraries
Total questions: 60
Worksheet time: 47mins
What will the following code return? import numpy as np; np.array([1, 2, 3]).dtype
int64
float64
list
array
How do you import the GeoDataFrame class from the geopandas library?
from geopandas import GeoDataFrame
import GeoDataFrame from geopandas
import geopandas as gpd; gpd.GeoDataFrame
from geopandas.GeoDataFrame import
Which line of code correctly reads a shapefile into a GeoDataFrame using Geopandas?
gpd.read_file('my_shapefile.shp')
gpd.open('my_shapefile.shp')
GeoDataFrame.read_file('my_shapefile.shp')
gpd.load('my_shapefile.shp')
Which function from rasterio is used to open and read raster data?
How can you extract the X and Y coordinates of a point geometry in Geopandas? Assume gdf is a GeoDataFrame containing a Point geometry.*
gdf.geometry.x, gdf.geometry.y
gdf.x, gdf.y
gdf['geometry'].x, gdf['geometry'].y
. gdf.loc[:, 'geometry'].x, gdf.loc[:, 'geometry'].y
How do you plot a GeoDataFrame using Geopandas?
Which library function would you use to calculate the distance between two geographic points?
geopy.distance.compute(point1, point2)
geopy.distance.calculate(point1, point2)
geopy.distance.measure(point1, point2)
geopy.distance.distance(point1, point2)
How do you save a raster file using Rasterio?
with rasterio.save('output.tif', 'w', **profile) as dst: dst.write(array)
with rasterio.open('output.tif', 'w', **profile) as dst: dst.write(array)
with rasterio.create('output.tif', 'w', **profile) as dst: dst.write(array)
rasterio.to_file('output.tif', 'w', **profile, array)
Which function from Matplotlib would you use to show an image?
In PyProj, how do you define a projection using the EPSG code 4326?
Proj('EPSG:4326')
Projection('EPSG:4326')
pyproj.Proj('+init=epsg:4326')
pyproj.CRS('EPSG:4326')
Which line of code correctly initializes an ipyleaflet Map?
Map(center=[lat, lon], zoom=10)
ipyleaflet.Map(center=[lat, lon], zoom=10)
leaflet.Map([lat, lon], zoom=10)
ipyleaflet.createMap(center=[lat, lon], zoom=10)
How do you add a marker to a map in Folium?
folium.Marker(location=[lat, lon]).add_to(map)
map.addMarker([lat, lon])
folium.addMarker(map, [lat, lon])
Marker([lat, lon]).add_to(map)
Which code snippet correctly opens a raster file using Rasterio?
raster = open('example.tif', 'r')
raster = rasterio.open('example.tif')
raster = rasterio.load('example.tif')
raster = rasterio.file('example.tif')
In Geopandas, how do you calculate the area of each geometry in a GeoDataFrame called 'gdf"?
gdf['area'] = gdf.area()
gdf['area'] = gdf.calculate_area()
gdf['area'] = gdf.geom.area()
gdf['area'] = gdf.geometry.area
Which PyQGIS method is used to add a vector layer?
qgis.addLayer(path, name, 'vector')
qgis.vectorLayer(path, name, 'ogr')
iface.addVectorLayer(path, name, 'ogr')
iface.loadLayer(path, name, 'vector')
How do you install a geospatial library, say 'geopandas', using pip?
install pip geopandas
pip install geopandas
pip get geopandas
geopandas pip install
What will the following code return? import shapely.geometry as geom; geom.LineString([(0, 0), (1, 1)]).length
1.0
1.414
2
0.5
What is ArcPy primarily used for?
Image processing
Web development
Geoprocessing within Esri ArcGIS environment
Statistical analysis
GeoPandas extends which library to work with spatial data?
NumPy
Pandas
Matplotlib
PyPlot
Which library is used for translating between GIS formats and extensions?
GDAL/OGR
RSGISLib
PyProj
Fiona
RSGISLib is a set of tools primarily used for what?
Vector data manipulation
Remote sensing and raster processing
Web mapping
Data cleaning
What is the main purpose of the PyProj library?
Data visualization
Working with spatial referencing systems
Machine learning
Data scraping
Which library is known for its array computing capabilities, often used in GIS for scientific computing?
Scikit-learn
NumPy
Rasterio
Fiona
Matplotlib is a Python library used for what?
Creating interactive web maps
Performing geospatial data analysis
Generating plots and visualizations
Handling raster data
Which library would you use to create interactive maps within a Jupyter Notebook?
Folium
ipyleaflet
Geemap
ArcPy
What is the primary use of the ReportLab library in GIS?
Data analysis
Creating PDF reports
Remote sensing
Map production
Folium library allows you to leverage which JavaScript library for web map visualizations?
ReactJS
D3.js
Leaflet
Vue.js
Geemap is specifically designed for integration with which platform?
ArcGIS Online
Google Earth Engine
OpenStreetMap
Mapbox
The LiDAR Python Package is used primarily for what type of data?
Satellite imagery
Light Detection and Ranging data
Street map data
Census data
Scikit-learn is a library that allows for what kind of data processing in Python?
Machine learning
Data scraping
Web development
Geospatial data conversion
What is the primary function of the pandas library in the context of GIS?
Data manipulation and analysis
Spatial data conversion
Creating interactive maps
Performing network analysis
Which library would you use for object-based segmentation and classification in remote sensing?
Geopandas
RSGISLib
ArcPy
PyProj
GDAL/OGR library supports how many raster and vector drivers, respectively?
97 raster, 162 vector
162 raster, 97 vector
100 raster, 150 vector
150 raster, 100 vector
Which library is specifically designed for handling and analyzing raster data?
Fiona
Shapely
Rasterio
Geopandas
Fiona is used with GeoPandas for what purpose?
For overlay operations
To handle spatial referencing systems
For machine learning tasks
To generate plots and visualizations
ipyleaflet is a fusion of Jupyter Notebook and which library for interactive map visualizations?
Leaflet
D3.js
OpenLayers
Mapbox GL
What is the main application of the NumPy library in geospatial analysis?
Creating PDF reports
Machine learning
Scientific computing with array-based operations
Web map visualizations
Real-World Scenario:* You need to analyze satellite imagery to identify deforested areas. Which Python library would you primarily use?
GeoPandas
RSGISLib
PyProj
Folium
How do you install the rasterio library in a Python environment
install rasterio
conda install rasterio
pip install rasterio
rasterio install
You have a GeoDataFrame with multipolygon geometries and want to convert all geometries to polygons. Which method should you use?
.to_polygon()
.explode()
.convert('Polygon')
.dissolve()
For creating an elevation profile from a digital elevation model (DEM), which Python library would be most suitable?
Matplotlib
GDAL
PyProj
Geopandas
What is the correct way to plot a GeoDataFrame gdf that contains point geometries using GeoPandas?
gdf.plot_point()
gdf.plot(kind='point')
gdf.plot(marker='o')
gdf.plot_geometry()
You need to find the distance between two points with latitudes and longitudes in a geodataframe. Which Python library helps you calculate this?
Geopy
Shapely
Rasterio
Fiona
You are tasked with analyzing traffic flow patterns in an urban area using Python. Which library would you use for network analysis?
NetworkX
PySAL
ArcPy
Geopandas
A city planner wants to overlay a GeoDataFrame of park locations with a GeoDataFrame of city regions to determine which parks are in which region. Which spatial operation would you use?
Union
Intersect
Spatial Join
Difference
You're designing a Python script to automatically update and process incoming GIS data daily. Which feature should you implement to handle unexpected errors in the data?
Logging
Use of try-except blocks
Hard-coding data corrections
Ignoring errors with a pass statement
Which function from Fiona is used to read data from a shapefile?
You need to calculate the area of a lake represented as a polygon in a GeoDataFrame. Which GeoPandas attribute would you use to get the area?
area
calculate_area()
get_area()
size
To display real-time data of a city's bus locations on a map on a website, which Python library would be most interactive and web-friendly?
Geopandas
Folium
PyProj
GDAL
What is the correct syntax to convert a list of coordinates into a LineString using Shapely?
LineString([list_of_coords])
shapely.geometry.LineString(list_of_coords)
LineString.create(list_of_coords)
LineString.create(list_of_coords)
You're analyzing climate data and need to handle both raster and vector data types. Which combination of libraries is most suitable?
Rasterio and GeoPandas
NumPy and Matplotlib
Pandas and PyProj
GDAL and Shapely
A researcher wants to compare elevation data from two different time periods to study glacier melting. Which library would help process the raster data?
PyProj
Rasterio
Geopandas
Fiona
How do you create a buffer of 10 units around a point geometry in Shapely?
point.buffer(10)
Buffer(point, 10)
point.create_buffer(10)
shapely.buffer(point, 10)
You are given a set of polygons representing park boundaries and need to find the park with the largest area. Which GeoPandas method helps you identify it?
max(gdf['area'])
gdf['area'].max()
gdf.max('area')
max_area(gdf)
In an urban study, you need to calculate the shortest path between two points in a road network. Which Python library should you use?
GeoPandas
NetworkX
RSGISLib
PyProj
