This is a great module, filling a real need. Thanks.

I'd love to have a "real" google maps formatter, so people could zoom in, zoom out, perhaps get driving directions. That would be perfect for my application.

Thanks!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

leschekfm’s picture

We needed a similar functionality in a recent project. The static googlemap is made clickable, so that another browser-tab loads maps.google.com centered on the provided lat/lng.

Our customer has already asked for a 'real' gmap as you suggested. So if you are lucky I will implement this in the near future, but please don't ask when it will happen.

Until then maybe this patch will help you.

wapnik’s picture

Here is what i used in my theme, a quick solution.

<?php
  if (isset($node->field_location[$node->language][0])) {
    ?>
      <div style="width:400px;height:300px">
        <iframe width="400" height="300" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?<?php print
          'q=' . $node->title . '@' . $node->field_location[$node->language][0]['lat'] . ','. $node->field_location[$node->language][0]['lng'] . '&' .
          'll=' . $node->field_location[$node->language][0]['lat'] . ','. $node->field_location[$node->language][0]['lng'] . '&' .
          'ie=UTF8&' .
          'z=12&' .
          't=m&' .
          'hl=' . $node->language . '&' .
          'iwloc=near&' .
          'output=embed';
        ?>"></iframe>
      </div>
    <?php
  }
?>

If an iframe is a good idea here, a theme function for it could be useful. And i think user editing the node (entity) should have an option to set the zoom level of the map, map dimensions, ... What about reading this data from the widget map? Some kind of wysiwyg. So the user can resize the map, center it somewhere, zoom and that would be what he can see after saving? Anyway this can be really useful module.

upupax’s picture

subscribe, this would be a really good feature.

Loikkk’s picture

i'm agree with upupax, a good feature to look ahead.

Subscribe :)

andypost’s picture

Maybe just add a setting to allow colorbox, lightbox integration

Verscienta’s picture

Subscribe, I would love to have this feature added. Thank you for all the hard work!

lklimek’s picture

Assigned: Unassigned » lklimek

Hi,

I'm working on this topic, hopefully I'll deliver working formatter soon.

andypost’s picture

great, I can review

carl.ben’s picture

sub

lklimek’s picture

Status: Active » Needs review
FileSize
9.54 KB

Hi,

here is my solution for this issue. The patch adds dynamic google map formatter to existing google maps formatter module.

You should apply this patch on latest 7.x dev version.

Please review and let me know if it works.

carl.ben’s picture

patch in #10 seems to work great!

andypost’s picture

Status: Needs review » Needs work
+++ b/modules/geolocation_googlemaps/geolocation_googlemaps.moduleundefined
@@ -18,8 +18,18 @@ function geolocation_googlemaps_field_formatter_info() {
-      ),
-    ),
+  ),

A lot of code-standart issues

+++ b/modules/geolocation_googlemaps/geolocation_googlemaps.moduleundefined
@@ -106,8 +121,15 @@ function geolocation_googlemaps_field_formatter_settings_form($field, $instance,
+  ¶
+  if ($type == 'geolocation_googlemaps_static') {
+  	$summary .= ' ('. $settings['map_imageformat'] .')';
+  }
+  $summary .= '<br />';
+  ¶

Tabs in code :(

+++ b/modules/geolocation_googlemaps/geolocation_googlemaps_dynamic_formatter.jsundefined
@@ -0,0 +1,63 @@
+  // Work on each map
+  $.each(Drupal.settings.geolocation,function(i, mapDefaults) {

why not use Drupal.behaviours?

PS: Please check drupal.org/coding-standards & try dgo.to/dreditor to see tabs troubles

lklimek’s picture

Status: Needs work » Needs review
FileSize
9.32 KB

Fixed coding standard issues (at least the most apparent ones).

I don't know if I did fix array braces properly.
Please take a look and explain me how it should look like.

EDIT: sorry it's broken ;). I'll post fixed patch later

lklimek’s picture

Here is fixed patch.

FreeFox’s picture

I tried to patch the latest dev version but it gave me this response:

# patch geolocation.module dynamic_google_maps_formatter-1115890-14.patch

patching file geolocation.module
Hunk #1 succeeded at 16 with fuzz 2 (offset -4 lines).
Hunk #2 FAILED at 37.
Hunk #3 FAILED at 52.
Hunk #4 FAILED at 116.
Hunk #5 FAILED at 135.
Hunk #6 FAILED at 164.
Hunk #7 FAILED at 320.
6 out of 7 hunks FAILED -- saving rejects to file geolocation.module.rej
The next patch would create the file geolocation.module,
which already exists! Assume -R? [n]
Apply anyway? [n] ^C

Files attached in zip file: geolocation.module, geolocation.module.orig and geolocation.module.rej

andypost’s picture

Seems everything works, let's get more reviews. My +1 to RTBC this patch

@lklimek Now it looks much better, for future check http://drupal.org/coding-standards and try coder module for suggestions

@FreeFox To apply a patch use patch -p1 < patchname.patch from module's folder. See http://drupal.org/patch

lklimek’s picture

@FreeFox: works for me:

lklimek@lklimek-dell:/tmp/qqq$ wget -q http://ftp.drupal.org/files/projects/geolocation-7.x-1.x-dev.tar.gz
lklimek@lklimek-dell:/tmp/qqq$ cd geolocation/
lklimek@lklimek-dell:/tmp/qqq/geolocation$ patch -p1 < ../dynamic_google_maps_formatter-1115890-14.patch
patching file modules/geolocation_googlemaps/geolocation_googlemaps.module
patching file modules/geolocation_googlemaps/geolocation_googlemaps_dynamic_formatter.js
lklimek@lklimek-dell:/tmp/qqq/geolocation$

derjochenmeyer’s picture

#15 #16

Or try git and use:
git apply -v [patchname.patch]
See: http://drupal.org/project/geolocation/git-instructions

jagermonster’s picture

The Dynamic google map seems to work well. Can this be commited into project?

FreeFox’s picture

Thanks for all the help on patching ;)

The patch works like a charm. +1 for commit here.

Good job lklimek!!

lklimek’s picture

Assigned: lklimek » Unassigned
Status: Needs review » Reviewed & tested by the community

Please commit.

jm.federico’s picture

Thanks guys

I just released beta-2, can you confirm it works against that version? If so I'll commit!

Cheers

lklimek’s picture

Status: Reviewed & tested by the community » Needs work

Hi,

the patch does not apply on latest beta-2.

lklimek’s picture

Status: Needs work » Needs review
FileSize
8.59 KB

Hi,

here is a fixed patch.
Please test it with 7.x-beta2.

andypost’s picture

Status: Needs review » Reviewed & tested by the community

Is this patch rolled against 7.x-1.x branch?

andrea.cavattoni’s picture

FileSize
34.57 KB

It's not working properly, check the last lines.
Here the module patched correctly and working...

Let me know if it's working

Bless

andypost’s picture

@cavax can you provide a patch?

lklimek’s picture

@cavax what's the difference between your version and patch from #24?

I've created a patch from your version and diff'ed it with mine. There are a few fixes I did manually in my version, but the overall patch looks the same.

Do you mean the end of my patch?

@@ -336,4 +408,4 @@
       form_error($element, $error['message']);
       break;
   }
-}
\ Brak znaku nowej linii na końcu pliku
+}

This is just white spaces - "\ Brak znaku nowej linii na końcu pliku" means "no new line on the end of file" - I've added new line on the end of file, as described in http://drupal.org/coding-standards#indenting .

Please explain me where the problem with patch #24 is.

jm.federico’s picture

Status: Reviewed & tested by the community » Needs work

Hello!

Haven't forgot about this.

There is an issue when showing more than one entity (node) with geolocation fields and dynamic maps where the IDS for each map will be the same, as it only uses the $delta to generate them. Should also use the field or instance ID.

I'm already working on some fixes to that, marking as needs work so I don't forget!

Guys, thanks for all the help!

andrea.cavattoni’s picture

I've tryed out your patch and i got many errors, so i changed it by hand.

yep, i got errors in those lines:

@@ -336,4 +408,4 @@
       form_error($element, $error['message']);
       break;
   }
-}
\ Brak znaku nowej linii na końcu pliku
+}
carvalhar’s picture

#26 module works fine (i was using beta2 and overwrote those files).

But how can i make the marker able to trace a route? Or at least, open the google maps page with this marker?

carvalhar’s picture

hey, this #26 module was working fine some days ago but now i get only an empty div:
<div style="width:300px;height:300px;" class="geolocation-map geolocation-googlemaps-dynamic" id="geolocation-googlemaps-dynamic-0"></div>

any reason why this is happening?
thanks
PS: i didn't change this code.

andrea.cavattoni’s picture

Try cleaning the cache or check if the module load the js file.
Are you using Firebug?

carvalhar’s picture

it's working today.
i have no idea why it didn't work, my impression was because something changed at google (maybe api) but today it's working again.

i have no idea why

andrea.cavattoni’s picture

That's drupal 7 i guess :-(

codekarate’s picture

I applied the patch in #24 against beta-2 and it seems to be working great. Thanks.

nagiek’s picture

Hey there, it looks like this needs a final push.

@cavax can you create a patch for #26? Just to compare with #24.

lysander19’s picture

I also applied the patch in #24 against beta-2 and it seems to be working great. Thanks.

jm.federico’s picture

Status: Needs work » Fixed

Hello everyone

I just committed the Live Google Maps formatter

Latest dev might break stuff if you have other modules integrating with this one, it changes some names on the JS!
If you have you own modules playing with this one, please check the commits messages.

Cheers

Status: Fixed » Closed (fixed)

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