I decided it could be beneficial to the community to provide the geoprocessing scripts I created using GDAL’s vector library, OGR, after a member of the GIS and Geography group on LinkedIn posted a question about geoprocessing with GDAL. GDAL/OGR can be a challenge to learn because of the scarcity of online examples, so I hope I am able to provide a little bit more to help those beginning to learn the ins and outs of GDAL and open source GIS programming.
I uploaded the example scripts to a [I decided it could be beneficial to the community to provide the geoprocessing scripts I created using GDAL’s vector library, OGR, after a member of the GIS and Geography group on LinkedIn posted a question about geoprocessing with GDAL. GDAL/OGR can be a challenge to learn because of the scarcity of online examples, so I hope I am able to provide a little bit more to help those beginning to learn the ins and outs of GDAL and open source GIS programming.
I uploaded the example scripts to a](https://github.com/csterling/ogrTools) for everyone to access. I hope they can help provide insight into how one could best utilize the geoprocessing tools within GDAL.
The scripts in the repository show how to perform the following geoprocessing tasks with GDAL/OGR:
-
Append – Adds one geometry or set of geometries to another.
-
Buffer – Creates a user-specified buffer (polygon) around the input geometry. Erosion can be achieved by passing a negative value to the buffer parameter.
-
Centroid – Returns or generates a point of an object’s geometric centroid/center.
-
Contains – Tests whether one geometry contains another.
-
Crosses – Tests whether one geometry crosses another.
-
Disjoint – Tests for disjointness between two geometries.
-
Distance – Finds and displays the shortest distance between two geometries.
-
Difference – Removes a section of a polygon where two geometries overlap.
-
Equals – Tests whether two geometries are equal or not.
-
Get Envelope – Returns the bounding envelope for a specific geometry
-
Get Fields – Returns all fields within a specific file.
-
Get Layer Extent – Returns the extent of the entire layer
-
Get Unique Values – Returns a list of all unique values within a specified field
-
Intersect – Tests for intersection between two geometries.
-
Intersection – Computes a geometric intersection of the input features. Features or portions of features which overlap in all layers and/or feature classes are written to the output feature class.
-
Simplify – Creates a simplified representation of the geometric object. All points in the simplified object will be within the tolerance distance (which is set by the user) of the original geometry.
-
Symmetric Difference – Removes a section of a polygon where two geometries overlap.
-
Union – Returns a representation of the union of the given geometric objects.
- Within – Tests whether one geometry is within another.