用于从geodjango字段创建google地图的模板标记。
django-gmaps的Python项目详细描述
此应用程序提供模板标记,以便从GeoDjango模型轻松创建Google地图
安装
- 将GOOGLE_API_KEY添加到您的设置中。
- 将'gmaps'添加到INSTALLED_APPS中。
用法
{% load gmaps %} <div id="mymap"></div> {% gmap_js %} {# prints out the <script> tag calling the Google Maps API #} {% map "mymap" object.location %} {% marker someobj.location %} {# all tags accept optional parameters that will be passed to the js constructor #} {% marker someobj.location "title" "'Hello, World!'" %} {% polygon someobj.mpoly %} {% polyline someobj.mpoly %} {% endmap %}