<p>GEOS django API中的缓冲区将使用当前坐标系使用的任何单位创建缓冲区。</p>
<p>如果你把所有的东西都存储在4326度(纬度/经度),那么你就必须找到一些将公里数转换成度数的复杂方法。但现在你越往北走,你的缓冲区就会严重扭曲。</p>
<p>一个更好的解决方案是将几何体重新投影到一个保持面积的投影中,通常这种投影可以跟踪单位(米)。</p>
<p>例如,如果要在北美创建缓冲区,可以使用使用米<a href="http://spatialreference.org/ref/sr-org/7314/" rel="nofollow">http://spatialreference.org/ref/sr-org/7314/</a>的投影</p>
<p>下面是一个使用Django GEOS API的示例:</p>
<pre><code> from django.contrib.gis.geos import Point
# Defines a point in lat/long
p = Point(-70, 50)
# This projection defines lat/long coordinate system
p.srid = 4326
# Transform into the 7314 projection using the OGC WKT format to define that projection
p.transform('PROJCS["NA Lambert Azimuthal Equal Area",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["degree",0.0174532925199433]],PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["false_easting",0.0],PARAMETER["false_northing",0.0],PARAMETER["longitude_of_center",-100.0],PARAMETER["latitude_of_center",45.0],UNIT["meter",1.0]]')
# Creates a buffered polygon of 1000 meters in radius
poly = p.buffer(1000)
</code></pre>