Hey everybody!
I am new here and unfortunately I have a problem with my mesh.
Because Polygon didn’t worked out with my points I decided to create a polygon with the polygon function from python, save it with Fiona and then load it into the mesh function from fenics.
Here is my code for creating and saving. But the last step is not so easy. Could somebody help me please?
from shapely.geometry import mapping, Point, Polygon
import matplotlib.pyplot as plt
import fiona
points = [(4.0, -4.0), (-1.0, 1.0), (1.0, 3.0), (2.0, 2,0), (0.01, 0), (2.0, 0), (5, -3)]
polygon = Polygon(points)
x,y = polygon.exterior.xy
plt.plot(x,y)
plt.show()
Polygon speichern----------------------------------------------
Define a polygon feature geometry with one attribute
schema = {
‘geometry’: ‘Polygon’,
‘properties’: {‘id’: ‘int’},
Write a new Shapefile
}
with fiona.open(‘my_shp2.shp’, ‘w’, ‘ESRI Shapefile’, schema) as c:
## If there are multiple geometries, put the “for” loop here
c.write({
‘geometry’: mapping(polygon),
‘properties’: {‘id’: 123},
})
This is the last part:
import numpy as np
import fiona
polygon = fiona.open(’/Users/*******/Documents/MA/my_shp2.shp’, ‘r’)
mesh = Mesh(polygon)
plot(mesh)
Also i installed fenics with docker and run it with a terminal. <— is this normal?
Thank you very much!
Greetings
Polygon do works. It was like the house from Santa and the area actually has the same number of points.