django-rest-framework-gis GeoFeatureModelSerializer 在序列化时返回 altered/incorrect 坐标

django-rest-framework-gis GeoFeatureModelSerializer returning altered/incorrect coordinates upon serialization

目前,我有一个 GeometryField,其中包含一个 Polygon,这是一个 GEOSGeometry。我打印了多边形的坐标,它们看起来很好,就在我指定的位置。然后,我保存模型的实例,然后用 GeoFeatureModelSerializer 反序列化,却发现我的多边形坐标已更改为非常小且接近赤道的东西。

这是最初存储在 GeometryField 中并存储在数据库中的 GEOSGeometry

POLYGON ((-79.94751781225206 40.44287206073545, 
          -79.94751781225206 40.44385187931003, 
          -79.94502872228624 40.44385187931003, 
          -79.94502872228624 40.44287206073545, 
          -79.94751781225206 40.44287206073545))

这是用 GeoFeatureModelSerializer 序列化后返回的。

[[-0.000718176362453, 0.000363293553554], 
 [-0.000718176362453, 0.000363316438548], 
 [-0.000718135112337, 0.000363316438548], 
 [-0.000718135112337, 0.000363293553554], 
 [-0.000718176362453, 0.000363293553554]]

我不知道是什么原因造成的。

非常感谢。

已通过指定 SRID 解决此问题。根据 Django 文档,SRID 是

Choosing an appropriate SRID for your model is an important decision that the developer should consider carefully. The SRID is an integer specifier that corresponds to the projection system that will be used to interpret the data in the spatial database. (https://docs.djangoproject.com/en/2.0/ref/contrib/gis/model-api/)

我对具有特定 SRID 的多边形执行操作并返回具有不同 SRID 的另一个多边形。我只需要 'cast' 返回我想要的 SRID 的多边形,GEOSGeometry(polygon, srid=some_value)。基本上,我返回的多边形被投影为我不想要的其他格式。