How to use the earthpy.clip function in earthpy

To help you get started, we’ve selected a few earthpy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github earthlab / earthpy / examples / plot_clip.py View on Github external
###############################################################################
# Clip the Data
# --------------
#
# Now that the data are opened as GeoDataFrame objects and in the same
# projection, the data can be clipped! Recall that in this example, the roads
# will be clipped to the United States boundary.
#
# To clip the data, make
# sure you put the object to be clipped as the first argument in
# ``clip_shp()``, followed by the vector object (boundary) to which you want
# the first object clipped. The function will return the clipped GeoDataFrame
# of the object that is being clipped (e.g. roads).

roads_clipped = ec.clip_shp(roads, country_boundary)

# Plot the clipped data
# The plot below shows the results of the clip function applied to the roads
# sphinx_gallery_thumbnail_number = 2
fig, ax = plt.subplots(figsize=(12, 8))
roads_clipped.plot(ax=ax, color="grey")
country_boundary.boundary.plot(ax=ax, color="black")
ax.set_title("Major NA Roads Clipped to US Border", fontsize=20)
ax.set_axis_off()
plt.show()

earthpy

A set of helper functions to make working with spatial data in open source tools easier. This package is maintained by Earth Lab and was originally designed to support the earth analytics education program.

BSD-3-Clause
Latest version published 3 years ago

Package Health Score

60 / 100
Full package analysis

Similar packages