Posted by vardas on April 16, 2010 at 7:43pm
I am hoping someone will be able to help me create a GMap block using Views.
Essentially what I want to be able to do is to take the Google Map that is shown when you click on the "User Locations" link and put it in a Block that can be added to any page (specifically in my case to the Home Page).
I have tried to use Views to do this but I cannot get the Content : Location option to appear in the Views list of Relationships. I expect there are other gaps in my knowledge but so far this is as far as I can get.
If anyone is able to provide explicit instructions on how to achieve this in Drupal I would be hugely grateful. My website is totally dependent on being able to do this!
Comments
I don't know if this may apply?
I created a view to attach GMap's to nodes a while ago, and posted the result at http://drupal.org/node/386848#comment-1696524
Other people seemed to get it working too. You may be able to import it & take it apart to see how it works. You will probably need to provide a views argument if it is not attached to a particular node.
I'm not sure if it relates to the 'user location' field, but it may be something to get you started. Hopefully others will chime in with suggestions, but take a look at it, the actual working version can be seen at
http://mmug.org.uk/event/tbc-ipad-apple-store-may-meeting
Thanks
Hi Drew,
Thanks for the link. I took a look at the various postings and it kinda makes sense to me (I think?) but my stumbling block is at:
Relationships - Content: Location
I do not see Content: Location as one of the possible relationships.
Do you have any idea what I might be doing wrong?
I wonder…
It may be that my view uses a 'location field'. Check my 'event' content type & you will see that there is a field of type 'Location', this is provided by the Location CCK module if I recall correctly. I think it is exposed to views whereas the 'users location' field (provided by the User Locations sub-module in Gmap) doesn't seem to be exposed to views. I'd expect it to appear in the users section of the fields.
I think a workaround would be to add a location field to users via the content profile module, than you should be able to access the location field, but this is just a guess.
You'd would be wise to search around in the Gmap issue queue & the location group to see if someone else has done this, it seems like a simple need.
Tried that
Yes I tried adding a location field via the content profile module and that doesn't seem to have helped. I know others have got this working so I must be doing something wrong. So frustrating!
Hadn't realised there was a separate Location group I will search it out.
Are you seeing something like this?
http://dl.dropbox.com/u/59660/Content-relationship.png
No Content!
My problem is that 'Content' does not appear in the drop down list of Relationship types!
Do I have something missing? A module perhaps?
View options
When first creating a view, you have the choice of "Location", "Node", "Comment", etc. If you choose "Location" (as I did), you won't see "Content" in the list of relationship types.
If you choose "Node" as the view type, you should be all set. In my particular solution, I specify that the GMap module use the Latitude and Longitude fields from the location module.