I have gmap and location in my drupal site, and can't figure out how to use views to show only markers meeting certain criteria. I have two content types with location settings. One is called Restaurants. Another is Nearby Attractions. I want to show a map on each Restaurant Node that has just the marker for that node, and also show markers for Nearby Attractions node which are within x miles of that Restaurant. Also, would like the zoom to be appropriate for that x miles setting. I can't see any way to do this in Gmap Views.

Comments

AlexBowman’s picture

No one seems to have come back to you, so here's a brief outline of how to do this:

1. Make your view, in the GMap options put in some dummy information for the GMap Macro to use (e.g. Centre, Zoom).

2. Export your view. Note the GMap Macro, in the next step this can be replaced by passing a different string to your view.

3. In node.tpl.php you can extract Location information from $node (e.g. the node's location). If you're using location.module to store your data this should be somewhere like $node->locations[0][locpick][user_latitude]; and $node->locations[0][locpick][user_longitude];

4. Now generate a string from the co-ordinates you've extracted from node.tpl.php in the format of a GMap Macro and pass that into the generated view.

johnv’s picture

Status: Active » Closed (won't fix)

Closing this very old issue. Please reopen if it is still valid.