I have a batch of polygons which could be a NumPy array, torch tensor, or any other nd-array of shape (230_000, 3, 2). 230_000 is the number of polygons, 3 indicates it’s a triangle, 2 is its x and y coordinates. I also have a batch of features of shape (230_000, 3, 3) (last is the color), it’s best the
Tag: polygon
How to have a poligon in the legend
I have a chart with 4 elements: blue square,blue triangle, red square and red triangle, I’m tryng to add these 4 items to the legend. when I add a polygon patch to the legend, it is displayed as a rectangle, even though the patch is of a triangle How can I get it to work? Answer You could use line
Remove a Polygon from a MultiPolygon with shapely in Python
I am working with spatial objects in Python using the shapely library. Given a MultiPolygon, I want to remove from it the Polygons which don’t contain an obstacle. However, I haven’t found a way to do this, even though I can get the coordinates from the MultiPolygon just by using the mapping function. I already know which Polygons I want
Extract points/coordinates from a polygon in Shapely
How do you get/extract the points that define a shapely polygon? Thanks! Example of a shapely polygon Answer The trick is to use a combination of the Polygon class methods: