I thought I give integration with gmap through views a go.
And it almost works, keep up the work with this great module
Actions taken
- create a page view
- add a field -> Content:Geolocation -> Formatter = Latitude text-based formatter
- add a field -> Content:Geolocation -> Formatter = Longitude text-based formatter
- Format choose gmap
- Gmap settings -> Data source = choose latitude and longitude fields -> latitude field = (first) Content:Geolocation -> longitude field = (second) Content:Geolocation
Result
- I get a map with a Drupal marker on it, yeah...
- But the marker is on position longitude / longitude.
No matter what fields I select in the gmap settings it will only place markers on longitude / longitude.
Comments
Comment #1
botrisTurns out the marker is not on longitude/longitude but it takes the entity_id and parses that.
So I excluded the Content:Geolocation from display and made two Global:php fields in views, one with output code:
and one with:
In a text based view, this outputs both values nicely, so it might work with OpenLayers, but with Gmap I get two errors:
Notice: Undefined property: stdClass::$views_php_2 in gmap_plugin_style_gmap->render() (line 154 of /Applications/MAMP/htdocs/site/sites/all/modules/gmap/gmap_plugin_style_gmap.inc).
Notice: Undefined property: stdClass::$views_php_3 in gmap_plugin_style_gmap->render() (line 155 of /Applications/MAMP/htdocs/site/sites/all/modules/gmap/gmap_plugin_style_gmap.inc).
Comment #2
botrisOk Global:php is the way to go for now to get Lat & Long info into views.
Displaying it on a map works with the "Extended GMap" format in views.
In the Extended GMap settings select Marker latitude with the corresponding Global:php field and Marker longitude with the other Global:php field.
Tip, when configuring the Global:php fields under "More" give the field a new administrative title, like 'Latitude' this makes selecting it easier.
Comment #3
andrea.cavattoni commentedI'm trying to do that with Global:php and extended Gmap, but i got an error:
Notice: Undefined property: stdClass::$field_data_field_geolocation_node_values in __lambda_func() (line 1 of /var/www/evxsf/modules/views_php/plugins/views/views_php_handler_field.inc(131) : runtime-created function).How can i get this working?
Comment #4
andrea.cavattoni commentedi still get an error and the marker is at the top part:-/
Notice: Undefined index: in template_preprocess_gmap_views_view_gmapextended() (line 53 of /var/www/evdfs/modules/gmap/gmap.views.inc).Comment #5
andrea.cavattoni commentedfixed changing the gmap.views.inc al line 53 this:
with this
but i got:
Comment #6
andrea.cavattoni commentedFixed using another way.
Still using extended gmap, but i had tu use the filed content that i've created before in cck.
So i used simply the field from cck (field_geolocation) for 2 times, one formatted as latitude and one formatted as long.
Now you can use the 2 fields in Extend gmap, one for lat and the other one for lng...
Is not necessary use Global:php and it doesnt work:(
Comment #7
iancawthorne commentedSubscribing.
Comment #8
iancawthorne commentedI think the error message :
Notice: Undefined index: in template_preprocess_gmap_views_view_gmapextended() (line 53 of /var/www/evdfs/modules/gmap/gmap.views.inc).which I also get using Gmap extend is a Gmap module issue, as I have tried using the Geofield (http://drupal.org/project/geofield) module fields and get exactly the same result.
Comment #9
iancawthorne commentedSee : http://drupal.org/node/1255514#comment-4889742
Comment #10
vacilando commentedcavax is right in #6 -- there is no need to use PHP with Extended GMap formatter.
Still, we should also be able to get this going with the GMap formatter. Any luck, anybody?
Comment #11
Oceanman commentedThis old thread is marked postponed http://drupal.org/node/1213668 but seems to be the same topic as here.
Has there been any progress with this? Has anyone found a solution to putting all your lat-long data (markers) on the same map?
Comment #12
rickharington commentedIm not getting any errors but I'm not getting any markers either. Just an empty map. It would be great if someone can export their view so that we can have a look if they got it working. I used the two fields as discussed above.
Comment #13
xandeadx commentedreplace in gmap_plugin_style_gmap.inc:
to
and
replace to
Comment #14
christianadamski commentedClosing all 7.x issues. It's time.