擅长:python、mysql、java
<p>要在SVG中使用lat/lon,需要将它们投影到像素(x/y)空间中。简单的转换可能如下所示:</p>
<pre><code>>>> x = (lon + 180) / 360 * image_width
>>> y = (90 - lat) / 180 * image_height
</code></pre>
<p>对于<code>image_width == 2 * image_height</code>的图像,这将为您提供类似于所发布链接的地图(看起来像<a href="http://en.wikipedia.org/wiki/Equirectangular_projection" rel="nofollow noreferrer">equirectangular projection</a>)的内容。在</p>
<p>要使用不同的投影(例如<a href="http://en.wikipedia.org/wiki/Mercator_projection" rel="nofollow noreferrer">Mercator</a>),请在应用转换之前使用GeoDjango中的<a href="http://docs.djangoproject.com/en/dev/ref/contrib/gis/geos/#django.contrib.gis.geos.transform" rel="nofollow noreferrer">GEOSGeometry.transform</a>方法。在</p>