I am trying to create a Gmap View with the data collected with this module. I have tried a few different configurations and I have not been able to make any work. In the actual node the maps show correctly using the Gmap display option.

In the Gmap View I have selected Style: Gmap with settings of, Grouping field: , Data Source: Choose Lat & Lng Fields.
I have tried using the field from my content type in every combination I can think of including: adding the field more than once with different formatting (latitude and longitude) and then selecting the correlating fields in Data Source. I have also tried having the field formatted as Gmap and then selecting that field in the Data Source.

Both of these configurations do show markers on the Gmap view, but the markers all show up in the middle of Africa (nowhere near the actual location of the pins in the node). I have confirmed the the lat and lng values that the view is displaying (in the bubble) is what is in the node edit.

If you have questions or would like me to do additional testing, please let me know and I will help out.

Cheers,

Will

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

swill’s picture

Any ideas or help on this? I need to resolve this as soon as possible.

Thanks,

Will

becw’s picture

Hi, I suspect that either the latitude/longitude fields that Geo provides are broken (I saw a mention of that here: http://drupal.org/node/429654#comment-1627832 ) and/or GMap's ability to use separate fields as a source for coordinates is broken (in my work with GMap a few months ago this was broken, though there has been active development on GMap since then so it may have been fixed).

I'll do some research and get back to you.

swill’s picture

I reviewed the comment you linked. I have tried with and without the patch and I cant make it work either way. I also installed the most recent version of Geo (there have been updates since this was opened).

This is still an issue...

swill’s picture

BTW, thanks for looking into this. I forgot that part... :)

swill’s picture

This still seems to be an issue. Have you been able to create a Gmap View with data collected with this module?

Cheers,

Will

becw’s picture

Project: GMap + Geo » GMap Module
FileSize
158.12 KB
162.1 KB

I think that this is actually an issue with GMap; the latitude and longitude values of Geo point fields show up fine in Views, but when I use the "GMap" view style and set the data source to "choose latitude and longitude fields", the values that appear in the gmap array are (1, 1)--in the ocean right next to Africa.

However, this is *not* an issue when the latitude and longitude are coming from independent decimal fields (not the recommended way to store geodata :) Maybe GMap is not looking at the output values of the Geo field...

swill’s picture

It looks as if this issue has moved from the issue queue of the GMap + Geo Module to the Gmap Module. The issue is that information entered via the Geo / Gmap + Geo module can not be mapped on a Gmap view... I just wanted to clarify because it was not obvious from the title and description anymore...

becw’s picture

Information entered via the GMap + Geo module is stored with Geo--after you enter it, it has no association with the gmap_geo module. GMap + Geo only provides the input widget. The root of the issue is actually getting the GMap module to use the data from the Geo module in a GMap view.

swill’s picture

thanks for clarifying that bec. :)

swill’s picture

Has there been any movement on this??? I need to get the Geo module working with Gmap Views.

becw’s picture

There hasn't been any movement on this in the past couple days. Lots of things have been changing with Geo, though! Join us on IRC in #drupal-geo sometime (:

swill’s picture

Hey bec,
I worked with vauxia a bunch tonight and put together a working version of a Gmap for Geo views plugin. I will get in touch with you tomorrow to figure out how we are going to work it in with your code.

Cheers...

becw’s picture

cool; I'll be available 9-11am CST tomorrow.

swill’s picture

Alright, here it is...

Let me know when you have had a chance to try it.

Cheers

becw’s picture

Project: GMap Module » GMap + Geo
Category: bug » task
swill’s picture

It is worth noting that my patch only works with 'Points' so far...

becw’s picture

I started to use your work today but I'm finding that geo_field cck fields are broken with the latest geo commits :(

swill’s picture

I will need to update my plugin once these two issues have been resolved in Geo...

http://drupal.org/node/489818
http://drupal.org/node/489988

becw’s picture

I've begun to address this in http://drupal.org/cvs?commit=232352

Note that:
* this code requires a patch to Geo at the moment: http://drupal.org/node/505572 -- and it still generates an SQL error (due to the cck field 'multiple' handler needing a set of vids, which the geo_data field handler does not provide).
* I have only tested this code with geo_data fields.

swill’s picture

I fixed the views issue (http://drupal.org/node/489988), so now we can complete this views plugin.

What is currently in the Gmap + Geo module needs a minor change in order to function correctly. Here is a patch...

diff --git a/drupal/sites/all/modules/gmap_geo/gmap_geo_plugin_style_gmap.inc b/drupal/sites/all/modules/gmap_geo/gmap_geo_plugin_style_gmap.inc
index 5c1b3af..2d2f0ba 100644
--- a/drupal/sites/all/modules/gmap_geo/gmap_geo_plugin_style_gmap.inc
+++ b/drupal/sites/all/modules/gmap_geo/gmap_geo_plugin_style_gmap.inc
@@ -122,7 +122,8 @@ class gmap_geo_plugin_style_gmap extends views_plugin_style {
       foreach ($this->options['geo_fields'] as $field => $display_options) {
         if (! $display_options['enabled']) { continue; }
         foreach ($rows as $r) {
-          $geo_array = geo_wkb_get_data($r->{$field . '_wkb'}, 'array_for_gmap');
+					$base_field = substr($field, 0, -4); // Edit by swill: this is because the $field variable ends with _geo, but we want to use the _wkb field...
+          $geo_array = geo_wkb_get_data($r->{$base_field.'_wkb'}, 'array_for_gmap');
           gmap_geo_map_feature($geo_array['value'], $geo_array['type'], $map);
         }
       }
swill’s picture

It turns out that your rewrite of my plugin has removed a lot of the functionality that is important to this plugin.

Things you removed that are important to the plugin:
- Marker selection. We need to be able to select what marker we want the field to display as.
- Popup text. The popup for the marker no longer contains the views information that should be passed.

I am looking to add back these features and I ran into something that I think needs to be fixed. Your 'array_for_gmap' does not support all the options for gmap markers (listed below). I am willing to extend your code and send you a patch, but I would like to make sure that we are on the same page on this. Should I just add the details to your numbered array? It seems wrong to me to have that array be a numbered array and not an associative array.

How should I go about adding back in this functionality? I have no problem just hacking your stuff to my needs, but if I am going to write it for me, I figure I might as well do it as you would like and give it to you.

Cheers,

Will

ps - structure of the marker array...
array(
'options' => array(),
'text' => 'start',
'longitude' => 12.196,
'latitude' => -58.13,
'markername' => 'route',
'offset' => 0,
),

becw’s picture

True, I did not address that aspect of it yet. I cut out the original config code so that I didn't have to deal with it in the proof-of-concept stage, but I would probably use that as a starting point. If you write something that works in general, that'd be great; I probably won't get to doing anything more elaborate for a few weeks.

swill’s picture

FileSize
3.96 KB

Alright, here is what I am currently working with. This patch includes the changes I made in #20.

This may not be the most elegant way to solve this problem, but it is a very simple solution that does not require the rest of the code to change. I basically just checked in gmap_geo_map_feature() to see if the additional information was passed in, and if it was I displayed it. I also updated my views plugin to pass the appropriate information when adding the markers to the map (I am setting 'markername' and 'text' in the views plugin).

This seems to be working for me, so let me know if you have problems or if you think I did something wrong.

Cheers,

Will

Allie Micka’s picture

I'm just going to tack this on here because it's affected by this discussion. With the latest version of geo, the $field is broken into an array ( to more closely resemble what it looks like to CCK formatters)

The takeaway is that you want to access wkb:

$geo_array = geo_wkb_get_data($r->{$field}['wkb'], 'array_for_gmap')

(you don't need to find the base and or append the _wkb) Thus the above code replaces the following:

$base_field = substr($field, 0, -4); // Edit by swill: this is because the $field variable ends with _geo, but we want to use the _wkb field...
$geo_array = geo_wkb_get_data($r->{$base_field.'_wkb'}, 'array_for_gmap');