It would be nice to have the ability to set the default map type for a map view.

I'll try to come up with a patch for this soon.

CommentFileSizeAuthor
#2 mapstraction-maptype-fix.zip2.93 KBbigbob446

Comments

bigbob446’s picture

I would definitally like this is there any word on a patch?

bigbob446’s picture

Issue tags: +fix, +Map Type, +mapstraction
StatusFileSize
new2.93 KB
Fix for Setting Default Map Type

Let me preface this with saying I know exactly 2 things about drupal. Jack and S#@t and jack just left town. I am a total newbie to drupal and I have never programmed in anything but in C++ and that was a while ago. Never the less I was able to put this together after 12 hours of pounding my head against the wall. The good news is this will:

ADD the ability to set the default map type for a mapstraction view.

Using:

To change the default map type:
1. Go to Your mapstraction view-->Style-->Settings:
2. In the “initial point” box you will find a new selection box called “Map Type”.
3. Select the map type you would like to use as default.
(NOTE: Yeah I know including the map type in Initial Point doesn’t make the most sense, but for some reason every other place I tried to put it didn’t seem to work… feel free to move it. Lol)

Installation:

1. Download the files I attached and use them to replace the files in the mapstraction installation folder. (sites/all/modules/mapstraction)
2. OR do A and B:
A) In the mapstraction folder find the file “mapstraction_style_map.inc”
locate the code (around line 63 to 69):

    $form['initial_point']['zoom'] = array(
      '#type' => 'textfield',
      '#title' => t('Zoom level'),
      '#size' => 2,
      '#maxlength' => 2,
      '#default_value' => $this->options['initial_point']['zoom'],
    );

Insert the following after the above code:

$form['initial_point']['maptype'] = array(
      '#type' => 'select',
      '#title' => t('Map Type'),
	  '#description' => t('Select which map type you would like to use as default: Standard Map, Satellite, or Hybrid'),
      '#options' => array(
        1 => t('Map'),
        2 => t('Satellite'),
        3 => t('Hybrid'),
      ),
      '#default_value' => $this->options['initial_point']['maptype'],
    );

B) In the mapstraction folder find the file “mapstraction.drupal.js”
Locate the code (around line 12 to 13):

    // Set up controls
    Drupal.mapstraction[id].addControls(this.controls);

Insert the following after the above code:

	// Select default mapType
	Drupal.mapstraction[id].setMapType(Number(this.initialPoint.maptype));

Posible issues:

When you update the view after making changes to the mapstraction style it seems to take a long time. This could be my computer. However there doesn’t seem to be a performance issue on the site using the page.

Attached Files:

The files attached are replacements for the same files located in the mapstraction module folder.

I hope this helps someone. This is my first post ever so sorry if I have given too much info or too little. Let me know if you have any questions.

PS I made these changes to the 6.x-1.0 version of the module

levelos’s picture

Status: Active » Fixed

available in the latest 2.x branch

Status: Fixed » Closed (fixed)
Issue tags: -fix, -Map Type, -mapstraction

Automatically closed -- issue fixed for 2 weeks with no activity.