Active
Project:
cck_map
Version:
5.x-3.2-1
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Reporter:
Created:
24 Nov 2007 at 09:03 UTC
Updated:
8 Dec 2008 at 14:57 UTC
how can i define default location zoom level and Map option (satellite), cause by default it start with full map
Comments
Comment #1
skimmas commentedJust found out how to change the default location. I know really know that much about coding so this might not be the right way to do it.
1. Open modules\cck_map\cck_map.js
2. go to line 12 -> « this.map.setCenter(new GLatLng(0, 0), 1); »
3. The numerical values are the latitude the longitude and the zoom level. Change to your liking :)
ex: this.map.setCenter(new GLatLng(40, -8), 5); sets the map to show Portugal and Spain
Comment #2
RobertNelsonVance commentedThis is a workaround, but it'd be nice for it to be configurable in the settings ui so that novice Drupal users and lazy Drupal experts can easily configure it.
Comment #3
ultimikeAnother way of doing it (without hacking the module) is to add some customized javascript code in a custom module.
The following snippet assumes your cck_map field is called "field_map" (then the javascript object is "field_mapmap").
You'll also need to ensure that this code snippet gets called after cck_map's initialization code is run. I used hook_form_alter and the "drupal_add_js()" function with $type = 'inline' as shown below.
(The coordinates used above center the map on the United States)
The if-statement ensures that the map doesn't already have another center defined (this happens when editing an existing node).
-mike