Draw an ellipse using Shapely

前端 未结 2 1220
北恋
北恋 2021-02-13 00:48

I\'m integrating Shapely into my code, and I have to deal with several different kinds of geometric objects. Most of my needs are satisfied with Lines, Polygons and LineStrings,

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-13 01:19

    For those who are interested, here is an example to create an ellipse with axis length of 15 and 20.

    import shapely.affinity
    from shapely.geometry import Point
    
    circle = Point(0, 0).buffer(1)  # type(circle)=polygon
    ellipse = shapely.affinity.scale(circle, 15, 20)  # type(ellipse)=polygon
    

提交回复
热议问题