Opened 8 years ago

Closed 8 years ago

#28195 closed New feature (fixed)

Make OSMWidget zoom level configurable

Reported by: Danilo Bargen Owned by: nobody
Component: GIS Version: dev
Severity: Normal Keywords: gis, osm, map, zoom
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

The OSMWidget has a default zoom level of 12 (as seen in django/contrib/gis/static/gis/js/OLMapWidget.js on line 55).

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:

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:

Change History (3)

comment:1 by Claude Paroz, 8 years ago

Triage Stage: UnreviewedAccepted
Type: UncategorizedNew feature

comment:2 by Danilo Bargen, 8 years ago

Has patch: set

comment:3 by Tim Graham <timograham@…>, 8 years ago

Resolution: fixed
Status: newclosed

In a7975260:

Fixed #28195 -- Added OSMWidget.default_zoom attribute.

Note: See TracTickets for help on using tickets.
Back to Top