Two questions about OpenLayers

Events happening in the community are now at Drupal community events on www.drupal.org.
camhoward's picture

I'm using OpenLayers along with Address Field, Geofield, and Geocoder and have created several maps for a current project. I'm looking for advice on two pieces I haven't figured out yet.

Is it possible to highlight a specific location on a map that shows several locations? For example, I have six nodes feeding their locations to one map. Each node has a different location and each node displays the map with all six locations. I'd like to have the map on each node highlight that node's location with a different color marker from the other node locations. Is this possible? If so, how?

I'm using Google Maps as the base layer. Is is possible to add a link to use the Google Maps "Get Directions" feature and have the current node's address automatically populate the Destination field? If so, how?

Thanks for any ideas or suggestions!

Cam

Comments

I know that there was an

miche's picture

I know that there was an add-on module in D6 that made pins different colors based on taxonomy. Maybe search in that direction.


Michelle Lauer
michellelauer.com

Taxonomy

camhoward's picture

Hi Miche,

Thanks for the thought. I can see I left out some important information in my original question. I should have specified I'm working in Drupal 7. And I'm using taxonomy to control which groups of nodes are displayed on which maps.

Now I'm looking for a way to control the color of each node's individual map marker within the context of the group of markers. I'll try Pat's idea of creating more Views and see if that will work.

Thanks,
Cam

Next Meetup

ppatterson-edc's picture

I can walk through my OpenLayers map during the next meetup - or you can email me directly. Definitely a way to color-code based on views. You set up a page display, give it an "OpenLayers Map" style. Then you create new display types called "OpenLayers Data" - each of these correspond with the "Layers" tab in OpenLayers (admin/build/openlayers/layers). You can change the style of the icon/pushpin that appears on the map in the Styles tab (admin/build/openlayers/styles).

I'm using Location module, MapBox, Views, and OpenLayers for my particular cocktail...

Views and Layers

camhoward's picture

Hi Pat,

Thanks. I think I'm still getting my head around the relationship between Views and Layers. Your note is a big help. I'll experiment with creating additional Views.

I hadn't looked at MapBox until you mentioned it -- looks like it could be very useful!

Thanks,
Cam

Solution?

ditcheva's picture

Did you find a solution? All of th eresponses you got seem to be Drupal 6 related though you specified you were using Drupal 7. :-( I'm in the same boat as you and cannot find the place where you're supposed to add your 'feature styles' because all the threads I'm reading are Drupal 6-specific. If you found a solution, please share!

Thanks!

OpenLayers Styles

zhangtaihao's picture

I've been working on a hopefully coherent approach to the whole variable styling need. The way I see it, you'd want to manage a list of styles, choose a style for varying content, and apply a specific style for a feature in a layer.

http://drupal.org/project/openlayers_styles

I hope you find this useful. Please feel free to raise ease-of-use problems in the issue queue as I've only been developing this with a particular client in mind.

In Openlayers > Styles

so4's picture

In Openlayers > Styles (Drupal 6) you can point to an external graphic for visualizing your marker. In the url for the graphic you can replace the name of the picture with a variable {value}.png. You can add to views a php customfield to make a rule: If the taxonomy term is x the value is x so the icon is x.png, so you have the same advantages of gmap taxonomy markers and you can easily add a more complex behavior with no need for another module. In this site (http://ascensoresvalparaiso.org/mapa-de-los-ascensores) we are building for a non profit a system to visualize the state of elevators of the city.

D7

japo32's picture

I'm hoping to do this in D7. Thanks so4!

2 Layers Solution

japo32's picture

I'd suggest creating 2 layers in the same map. 1 layer for all the nodes and 1 layer for the specific node itself.

Then put the single node-layer on top. this way each map can be customized.

New Hampshire

Group categories

Regional Audience

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: