Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
I would like to create a view with geolocation field in order to display multiple of locations stored by the members of my website in one map. How can I do this? I can display a list of maps but I can not gathering the fields in one map.
Thanks
Comment | File | Size | Author |
---|---|---|---|
#9 | geolocation_1213668.patch | 5.99 KB | xandeadx |
Comments
Comment #1
jm.federico CreditAttribution: jm.federico commentedHi Loikkk
Unfortunately it is not possible right now without some custom code. A widget for that is part of the future of the module, but it is on hold right now.
Will mark as postponed until I get some time to work on it.
Cheers
Comment #2
Loikkk CreditAttribution: Loikkk commented@jm.federico
Hello I'm ready to bring some custom code, but I don't know where to start exactly.
I'm developping a website and I really do need this feature on maps.
Do you have any clue for that?
Thanks a lot
Comment #3
jm.federico CreditAttribution: jm.federico commented@Loikkk
I can't really help you with the views side of the story, have never created a views plugin. I did something similar once but did the whole thing myself:
I created a module that loaded all the nodes that I wanted to print on the map, from those nodes I would grab the information from the location field, and then add all the lat/lng values to the "settings" in the Drupal js object using drupal_add_js. This gives you all the lat/lng values you need so you can add them on a map on the JS side.
Then, using jQuery and the gmap API, you create a map, and then using the $.each() function you iterate over the array where you have all the lat/lng values and add them as markers.
You can jave a look at the JS from the module to see how the create a map, and how to add markers to it.
The key to the whole thing is to have all the lat/lng pairs send to the JS side of Drupal.
Hope it helps.
Comment #4
Loikkk CreditAttribution: Loikkk commented@jm.federico :
Hello,
Thanks a lot for your anserw. It seems to be a good method to add this feature.
Can you please send me the module that You have mentionned in order to custom it further?
Thanks a lot in advance,
Comment #5
jm.federico CreditAttribution: jm.federico commentedSorry, don't have it at hand, don't have access to the server where the module is hosted anymore, and didn't keep a copy.
Comment #6
Loikkk CreditAttribution: Loikkk commented@jm.federico
No prob, You gave good points from where to start. I will try to do it myself
Thank you,
Comment #7
andrea.cavattoni CreditAttribution: andrea.cavattoni commentedhttp://drupal.org/node/1197824 :-D
Comment #8
Patroclas CreditAttribution: Patroclas commentedThis can also be done with OpenLayers. In Views, create an OL data overlay and add the geolocation field twice to the view, setting them to read different data - one for Latitude, and one for Longitude. It works well.
[EDIT - Correction - I don't know why I thought this worked, but I am now unable to reproduce it]
Comment #9
xandeadx CreditAttribution: xandeadx commentedI write first version views style plugin.
Usage:
Screenshots:
http://s1.hostingkartinok.com/uploads/images/2012/09/448c3854921071e0c4f...
http://s3.hostingkartinok.com/uploads/images/2012/09/e5bae4b11b5a98808b5...
http://s1.hostingkartinok.com/uploads/images/2012/09/22a24c6f2e6ac81f64d...
http://s2.hostingkartinok.com/uploads/images/2012/09/940bf53358bcde49152...
Next versions will be available on http://drupal.org/sandbox/xandeadx/1782036
Comment #10
markwk CreditAttribution: markwk commented@xandeadx great job getting the code to start this. It indeed works, though I wonder if we might be better off looking at how geolocation widget input data can be integrated with one of the mapping systems like gmap or openlayers. It's not likely worth anyone's time to guild out a full system when other systems already exist.
Comment #11
arctgy CreditAttribution: arctgy commentedComment #12
RdeBoerAll of this and more has been available out-of-the-box for some time for 3 mapping engines (Google Maps, OpenLayers and Leaflet) when you use the Geolocation Field module with "IP Geolocations Views and Maps", http://drupal.org/project/ip_geoloc.
Comment #13
Funksmaname CreditAttribution: Funksmaname commentedI use ip_geoloc to render the maps, and you can filter maps to users by using the flags module to only include nodes a particular user has flagged... it's a great combination!
Comment #14
ChristianAdamski CreditAttribution: ChristianAdamski as a volunteer commentedClosing all 7.x issues. It's time.