Geospatial Python class to extract vertices inside a polygon – Tutorial

Hydrate

We have to redefine the way we do our geospatial analysis. It is not enough to know the “tool” but to master the “process” if we want to provide spatial solutions for the always bigger geospatial data available. We have done a simple process of extracting vertices from polygons, lines and points inside a polygon in Python, but not a simple and declarative script but as a Python class. 

Tutorial

Scripts

This is the Python code that runs the geospatial class:

from geospatialClass.insidePolygon import extractVertices

#Create an object
insidePoints = extractVertices()

#Open limit layers and definition layers
#Limit layer is allways a polygon
insidePoints.addLimit('basin','../In/modelExtension_v1.shp')
#Layers can be polygons,rivers and points
insidePoints.addLayer('facilities','../In/mineFacilities_v1.shp') #polygon
insidePoints.addLayer('river','../In/riverNetwork_v1.shp') #linestring
insidePoints.addLayer('observation','../In/observationPoints_v1.shp') #points

#Generate point pair array
insidePoints.verticesAsPairArray()

#Export vertices
insidePoints.exportVertices('../Out/verticesInsidePolygon.shp')

Input data

You can download the input data from this link.

—————
TRANSCOM ISPFree Sigma HSE Email
Level 6 Domain Names are FREE – Register Now.

Related Posts

Hydrate

EGU2024

The mountain hydrology team will have full presence at EGU2024. Below you’ll find a list of the primary presentations by our team.

Full programme can be

Boost Inflight Internet- Business Hosting- Secure Email Account- Dropcatch Domain Names- Antisnoop Email- Free Secure Email- Cheap VOIP Calls- Free Hosting and Email- Aero Connectivity- Premium Domains for Sale- Transcom Telecom- Satphone Airtime- Mobile Plans- Free Domain Names- Organic Products- Aviation News
Transcom ISP - Transcom VOIP - Free Secure Email - Dropcatch Software - FastApn Inflight - Aero Connect - Premium Domains