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

CommentFileSizeAuthor
#9 geolocation_1213668.patch5.99 KBxandeadx
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jm.federico’s picture

Status: Active » Postponed

Hi 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

Loikkk’s picture

@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

jm.federico’s picture

@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.

Loikkk’s picture

@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,

jm.federico’s picture

Sorry, 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.

Loikkk’s picture

@jm.federico

No prob, You gave good points from where to start. I will try to do it myself

Thank you,

andrea.cavattoni’s picture

Patroclas’s picture

This 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]

xandeadx’s picture

Priority: Normal » Major
Status: Postponed » Needs review
FileSize
5.99 KB

I write first version views style plugin.

Usage:

  1. Enable module Geolocation Views
  2. Create new View by nodes with display Page
  3. Add Geolocation field to fields list
  4. Change style to "Geolocation Map"
  5. In style options - set Geolocation field
  6. Save.

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

markwk’s picture

@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.

arctgy’s picture

RdeBoer’s picture

All 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.

Funksmaname’s picture

I 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!

ChristianAdamski’s picture

Component: Geolocation field » Geolocation Field / Backend
Issue summary: View changes
Status: Needs review » Closed (won't fix)

Closing all 7.x issues. It's time.