Code

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#9210 closed (invalid)

zoom does not effected, when use GoogleMap(zoom=x, ...) with zoom params..

Reported by: kitlycol@… Owned by: jbronn
Component: GIS Version: 1.0
Severity: Keywords: google zoom gis
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description (last modified by jbronn)

In the google map template js file( django/contrib/gis/templates/gis/google/js/google-map.js)

map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds))

should be changed to:

map.setCenter(bounds.getCenter(), {{ zoom }})

otherwise when use GoogleMap(zoom=x, ...) with zoom params, zoom does not effected actually .

Attachments (0)

Change History (4)

comment:1 Changed 6 years ago by jbronn

  • Description modified (diff)
  • Keywords google zoom gis added
  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to jbronn
  • Patch needs improvement unset

comment:2 Changed 6 years ago by jbronn

  • Resolution set to invalid
  • Status changed from new to closed

The problem here is that you're not specifying a coordinate pair to center the zoom at. When no default zoom level and center coordinate is provided, and overlays are passed in (e.g., via the polygons, polylines or markers keywords), then the default behavior is to calculate an appropriate zoom level in the JavaScript. Thus, all you need to do is:

GoogleMap(zoom=x, center=(longitude, latitude), ...)

comment:3 Changed 6 years ago by jbronn

  • Description modified (diff)

comment:4 Changed 6 years ago by kitlycol@…

That is right .

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.