[Django] #33637: Regression in feature zoom for MapWidget

8 views
Skip to first unread message

Django

unread,
Apr 12, 2022, 5:10:50 AM4/12/22
to django-...@googlegroups.com
#33637: Regression in feature zoom for MapWidget
----------------------------------------+------------------------
Reporter: Claude Paroz | Owner: nobody
Type: Bug | Status: new
Component: GIS | Version: 4.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
----------------------------------------+------------------------
When I rewrote MapWidget for OpenLayers 3 in [2ebfda38e], the code to
autozoom to the initial feature (if present) was changed from:

{{{
this.map.zoomToExtent(feat.geometry.getBounds());
if (this.options.geom_name === 'Point') {
this.map.zoomTo(this.options.point_zoom);
}
}}}
to:
{{{
this.map.getView().fit(extent, this.map.getSize(), {maxZoom:
this.options.default_zoom});
}}}

As a result, the zoom is often the `default_zoom`, which is mostly not
adequate at all (not enough zoom). If we simply remove the maxZoom, the
zoom is too high for points (hence the `point_zoom` in the initial
version). I think instead of `maxZoom`, a `minResolution` (see
https://openlayers.org/en/latest/apidoc/module-ol_View-View.html#fit)
would be more appropriate.

We would probably need to reintroduce some `point_zoom` variable, as
providing a hard-coded value is not an option.

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

Django

unread,
Apr 13, 2022, 3:50:30 AM4/13/22
to django-...@googlegroups.com
#33637: Regression in feature zoom for MapWidget
--------------------------------------+------------------------------------

Reporter: Claude Paroz | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: GIS | Version: 4.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Mariusz Felisiak):

* type: Bug => Cleanup/optimization
* stage: Unreviewed => Accepted


Comment:

Using `minResolution` sounds reasonable.

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

Django

unread,
Apr 13, 2022, 11:38:53 AM4/13/22
to django-...@googlegroups.com
#33637: Regression in feature zoom for MapWidget
--------------------------------------+------------------------------------
Reporter: Claude Paroz | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: GIS | Version: 4.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

* has_patch: 0 => 1


Comment:

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

I finally opted for a hard-coded value, as IMO a resolution of `1` should
be accurate for most (all?) layer types.

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

Django

unread,
Apr 14, 2022, 4:03:58 AM4/14/22
to django-...@googlegroups.com
#33637: Regression in feature zoom for MapWidget
-------------------------------------+-------------------------------------
Reporter: Claude Paroz | Owner: Claude
Type: | Paroz
Cleanup/optimization | Status: assigned

Component: GIS | Version: 4.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* owner: nobody => Claude Paroz
* status: new => assigned


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

Django

unread,
Apr 14, 2022, 5:50:46 AM4/14/22
to django-...@googlegroups.com
#33637: Regression in feature zoom for MapWidget
-------------------------------------+-------------------------------------
Reporter: Claude Paroz | Owner: Claude
Type: | Paroz
Cleanup/optimization | Status: closed
Component: GIS | Version: 4.0
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by GitHub <noreply@…>):

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


Comment:

In [changeset:"08f30d1b6ac9b7bc05857f88a70277d5ceb27ba1" 08f30d1b]:
{{{
#!CommitTicketReference repository=""
revision="08f30d1b6ac9b7bc05857f88a70277d5ceb27ba1"
Fixed #33637 -- Improved initial zoom level in MapWidget.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/33637#comment:4>

Reply all
Reply to author
Forward
0 new messages