I've got a custom module to create a gmap using the api. As soon as I add a "shapes" array, it does not display, nor do any markers that I have set up (which shows ok, with no "shapes" included). However, if I revert the module back to 7.x-1.0-beta1, the shapes and markers load up ok.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

podarok’s picture

Version: 7.x-2.2 » 7.x-2.x-dev
Status: Active » Closed (cannot reproduce)

feel free to reopen this when bug still hosts at latest dev

iancawthorne’s picture

Status: Closed (cannot reproduce) » Active

Hi podarok

I've just given this a try on the latest dev (and also the 2.4 release) and am getting the same problem. As soon as I comment out the shapes array, the pins I also have set up show ok.

Is there anything can do to help with this?

podarok’s picture

Yup
Please, Do provide a patch against latest dev with test coverage for fix and post it here

iancawthorne’s picture

I will take a longer look at this (not being the most fluent in javascript!), but for now a few notes on the problem...

This is the line that is kicking the error in the console (line 125 of gmap_shapes.js) and commenting it out at least allows the markers to show, so there are no js errors..
obj.map.addOverlay(shape.shape);

This is the error that is given...
TypeError: 'undefined' is not a function (evaluating 'obj.map.addOverlay(shape.shape)')

iancawthorne’s picture

I've attached a patch which should allow polylines and polygons to work.

johnv’s picture

Status: Active » Needs review

better status.
@iancawthorne , ou t of curiosity: does your patch revert the 1.x status, or does it contain new code?

Status: Needs review » Needs work

The last submitted patch, gmap-shapes-support-1887506-5.diff, failed testing.

iancawthorne’s picture

Oops forgot to add the correct file extension. This one should work.

@johnv I'm not sure what you mean? This patch is for the 2.x branch of the module, not 1.x.

johnv’s picture

@iancawthorne, Yes, I know. But since "if I revert the module back to 7.x-1.0-beta1, the shapes and markers load up ok", I was wondering if you undid/reverted any changes from the 2.x branch.

podarok’s picture

Status: Needs work » Needs review

ping bot with a status "needs review"

podarok’s picture

+++ b/js/gmap_shapes.jsundefined
@@ -118,17 +129,16 @@ Drupal.gmap.addHandler('gmap', function (elem) {
-    if (obj.vars.behavior.clickableshapes) {
+	  /*if (obj.vars.behavior.clickableshapes) {
       GEvent.addListener(shape.shape, 'click', function () {

You should use whitespaces not tabs in code http://drupal.org/coding-standards#indenting

Status: Needs review » Needs work

The last submitted patch, gmap-shapes-support-1887506-5.patch, failed testing.

podarok’s picture

Your patch can`t be applied to 7.x-2.x-dev version
needs reroll

iancawthorne’s picture

Updated patch attached with tabs converted to spaces.

@johnv As far as I can tell, the current 2.x shapes javascript file hasn't been touched and is a direct copy from the 1.X branch. Gmap API3 is different to API2 for shapes so this patch addresses this, so as far as I can tell there aren't any changes undone on the 2.x branch .

podarok’s picture

Status: Needs work » Needs review

You should set needs review for testbot

Status: Needs review » Needs work

The last submitted patch, gmap-shapes-support-1887506-14.patch, failed testing.

podarok’s picture

patch can`t be applied to current 7.x-2.x
needs reroll

iancawthorne’s picture

Hi podarok,

I'm not sure what I need to do to the patch for it to apply to the current 7.x-2.x

I've made the patch against 7.x-2.x from the git repository. (This is the first patch I've made).

podarok’s picture

http://qa.drupal.org/pifr/test/460798
testbot couldn`t apply Your patch
so
git pull 7.x-.2x --rebase
git diff 7.x-2.x > patch.patch
and post it here for review

iancawthorne’s picture

Status: Needs work » Needs review
FileSize
2.75 KB

Thanks podarok, here's another attempt!

podarok’s picture

Status: Needs review » Needs work
Issue tags: +Needs manual testing

patch looks nice
looks like this code needs manual testing
I`ll be glad to see a few screenshots...

iancawthorne’s picture

@podarok What sort of screenshots would you like to see? I've been using the gmap api for my testing.

podarok’s picture

#20 with and without patch
as I see - patch touches js layer, and testing system can`t be hlpfull with quality check. So screenshots are good enouph for comiting this into repository

iancawthorne’s picture

Two screenshots attached (hopefully what you would like). First shows the Google Map with markers and pins set, but nothing rendering on the map. Second shows the same page with the patch applied with the markers and shape (polyline) loading up ok.

podarok’s picture

Assigned: Unassigned » podarok
Issue tags: -Needs manual testing

Thanks!!!!

removing tag

podarok’s picture

Assigned: podarok » Unassigned
Status: Needs work » Fixed

#20 commited pushed to 7.x-2.x-dev
will be tagged in feature minor update release

Thanks!

podarok’s picture

Status: Fixed » Closed (fixed)
zhuber’s picture

I'm using 7.x-2.x-dev and I still cannot get my polygon to show up on my gmap view, is there something I'm doing wrong?

It looks correct to me, but it doesn't render out any shapes on the map:

/*
* Implements hook_gmap().
*/
function example_gmap($op, &$map) {
  if (!empty($map) && $op == 'pre_theme_map') {
    $shapes = array();
    $shapes[] = array(
      'type' => 'polygon',
      'points' => array(
        array(32.940318, 117.065921),
        array(32.990318, 117.065921),
        array(33.0, 117.0),
        array(33.0, 117.65921),
      ),
      'style' => array('ff0000', 5, 80, '00ff00', 60),
    );
    $map['shapes'] = $shapes;
  }
}
gillarf’s picture

I have exaclty the same problem. @zhuber Did you find a solution to this?

I am not able to change anything in the $map array at all in pre_theme_map.

zhuber’s picture

I was able to get it to work at one point, but I'm not sure what I did to fix it. I may have fixed it by messing with the module weight. It was a while back, but I remember messing with the module weights quite a bit in an effort to get this hook to work.

podarok’s picture

Issue summary: View changes
Status: Closed (fixed) » Closed (cannot reproduce)

due to #30 closing this issue
please - create new follow-up issue with a proper issue template filled and how-to reproduce a bug

jboeger’s picture

I cannot get shapes to work on any recent version of gmap (production and dev.)
Switching themes etc and nothing works. I have employed patches for markers and
now the markers are working.

when I go to /map/macro
I am able to put a point on the map. Nothing happens when I try line, circle,
or polygon... except for a resulting error on my logs page:

Theme hook gmap_macro not found.

Any ideas?