[Django] #28195: Make OSMWidget zoom level configurable

26 views
Skip to first unread message

Django

unread,
May 12, 2017, 8:33:59 AM5/12/17
to django-...@googlegroups.com
#28195: Make OSMWidget zoom level configurable
-------------------------------------+-------------------------------------
Reporter: Danilo | Owner: nobody
Bargen |
Type: | Status: new
Uncategorized |
Component: GIS | Version: master
Severity: Normal | Keywords: gis, osm, map, zoom
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
The OSMWidget has a default zoom level of 12 (as seen in
django/contrib/gis/static/gis/js/OLMapWidget.js on line 55).

{{{#!javascript
default_zoom: 12,
}}}

That zoom level is not only used as default zoom level, but also as max
zoom level for fitting the map to data:

{{{#!javascript
this.map.getView().fit(extent, this.map.getSize(), {maxZoom:
this.options.default_zoom});
}}}

This causes maps to be zoomed out considerably even when showing a pretty
small polygon with a few meters in diameter. That makes fitting the zoom
level to the data pretty useless.

Unfortunately this value is not configurable, in contrast to `default_lat`
and `default_lon`. Therefore as a first, non-controversial change I'd
suggest to make this value configurable in the OSMWidget. I'll provide a
pull request for that shortly.

Some further comments:

- The default zoom level should probably be decoupled from map zoom
fitting.
- The default zoom level is different from the one used in admin, where
it's 4: https://code.djangoproject.com/ticket/26774

--
Ticket URL: <https://code.djangoproject.com/ticket/28195>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 12, 2017, 8:42:21 AM5/12/17
to django-...@googlegroups.com
#28195: Make OSMWidget zoom level configurable
-------------------------------------+------------------------------------
Reporter: Danilo Bargen | Owner: nobody
Type: New feature | Status: new
Component: GIS | Version: master
Severity: Normal | Resolution:
Keywords: gis, osm, map, zoom | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+------------------------------------
Changes (by Claude Paroz):

* type: Uncategorized => New feature
* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/28195#comment:1>

Django

unread,
May 12, 2017, 8:44:25 AM5/12/17
to django-...@googlegroups.com
#28195: Make OSMWidget zoom level configurable
-------------------------------------+------------------------------------
Reporter: Danilo Bargen | Owner: nobody
Type: New feature | Status: new
Component: GIS | Version: master
Severity: Normal | Resolution:
Keywords: gis, osm, map, zoom | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+------------------------------------
Changes (by Danilo Bargen):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/8492 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/28195#comment:2>

Django

unread,
May 14, 2017, 2:31:28 PM5/14/17
to django-...@googlegroups.com
#28195: Make OSMWidget zoom level configurable
-------------------------------------+------------------------------------
Reporter: Danilo Bargen | Owner: nobody
Type: New feature | Status: closed
Component: GIS | Version: master
Severity: Normal | Resolution: fixed
Keywords: gis, osm, map, zoom | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"a7975260b50282b934c78c8e51846d103636ba04" a7975260]:
{{{
#!CommitTicketReference repository=""
revision="a7975260b50282b934c78c8e51846d103636ba04"
Fixed #28195 -- Added OSMWidget.default_zoom attribute.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28195#comment:3>

Reply all
Reply to author
Forward
0 new messages