Skip to content

Tarik Billa

  • Web Development
    • html
    • vue.js
    • laravel
    • css
    • javascript
    • jquery
    • node.js
    • php
    • asp.net
  • Programming
    • python
    • java
    • c
    • c++
    • c#
  • git
  • android

shapely

How do I plot Shapely polygons and objects using Matplotlib?

February 6, 2023 by Tarik

Use: import matplotlib.pyplot as plt x,y = polygon1.exterior.xy plt.plot(x,y) Or, more succinctly: plt.plot(*polygon1.exterior.xy)

Categories python Tags matplotlib, python, shapely Leave a comment

Could not find library geos_c or load any of its variants

January 7, 2023 by Tarik

Installed shapely using pip, and had the same problem. So I went ahead and installed it like so: sudo apt-get install libgeos-dev And it worked. I’m running Ubuntu, so if you’re on Fedora, you should run: sudo yum install geos-devel On MACOS you can run: brew install geos

Categories python Tags python, shapely Leave a comment

Extract points/coordinates from a polygon in Shapely

December 31, 2022 by Tarik

The trick is to use a combination of the Polygon class methods: from shapely.geometry import Polygon # Create polygon from lists of points x = [0.0, 0.0, 1.0, 1.0, 0.0] y = [0.0, 1.0, 1.0, 0.0, 0.0] poly = Polygon(zip(x,y)) # Extract the point values that define the perimeter of the polygon xx, yy = … Read more

Categories python Tags polygon, python, shapely Leave a comment
Newer posts
← Previous Page1 Page2

Tarik Billa

Software Engineer
tarikbilla@gmail.com
+8801884414000
  • Reuse a hash in YAMLApril 17, 2024
  • Dockerfile: how to redirect the output of a RUN command to a variable?April 16, 2024
  • How to cd to a directory with spaces in the directory name?April 16, 2024
  • Maximum MIME type length when storing the type in a databaseApril 16, 2024
  • What is the difference between Unit, Integration, Regression and Acceptance Testing?April 16, 2024
© 2026 Tarik Billa