Уведомления

Группа в Telegram: @pythonsu

#1 Апрель 11, 2012 15:39:15

mc
От:
Зарегистрирован: 2011-09-21
Сообщения: 19
Репутация: +  0  -
Профиль   Отправить e-mail  

django-floppyforms

может кто-то сталкивался с подобным и сможет подсказать.
Использую виджет из пакета 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 сказано, что сие возможно. Но примера нет и у меня проблема.



Офлайн

#2 Май 9, 2012 02:01:47

Ferroman
От:
Зарегистрирован: 2006-11-16
Сообщения: 2759
Репутация: +  1  -
Профиль   Отправить e-mail  

django-floppyforms

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);

Офлайн

Board footer

Модераторировать

Powered by DjangoBB

Lo-Fi Version