Найти - Пользователи
Полная версия: django-floppyforms
Начало » Django » django-floppyforms
1
mc
может кто-то сталкивался с подобным и сможет подсказать.
Использую виджет из пакета django-floppyforms, который рисует карту и в текстовое поле вносит координаты точки установленной пользователем.
class GMapPolygonWidget(floppyforms.gis.BaseGMapWidget, floppyforms.gis.PolygonWidget):
    pass
class FindAdvertForm6(floppyforms.Form):
    poly = floppyforms.gis.PolygonField(widget=GMapPolygonWidget())    
вопрос в том, как сделать, чтобы карта по умолчаниб выводилась бы не в точке с координатами 0,0? Нужные координаты мне хотелось бы передавить из представления. В документации http://django-floppyforms.readthedocs.org/en/latest/geodjango.html#id1 сказано, что сие возможно. Но примера нет и у меня проблема.
Ferroman
The following options can be passed to the widget constructor:

base_layer: an OpenLayers.Layer instance (or an instance of a subclass) that will be used as a base layer for the map. Default: Metacarta’s base WMS layer.
color: the color of the features drawn on the map. Default: ‘ee9900’.
default_lon: the default longitude to center the map on if there is no feature. Default: 0.
default_lat: the default latitude to center the map on if there is no feature. Default: 0.


Я думаю как-то так:
var options = {
    geom_type: OpenLayers.Geometry.Point,
    id: 'id_point',
    is_point: true,
    map_id: 'point_map',
    name: 'My awesome point',
    default_lon: 10,
    default_lat: 10
};
var point_map = new MapWidget(options);
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB