1

I have an open layers view that displays the numbers of reports for each country.

Can i display it other way for instance with dynamic circles markups : 3 reports : small circles , 50 reports : medium circles etc ...

example: http://reliefweb.int/

1 Answer 1

1

You can do that by passing a context function in Javascript that replaces the $-placeholders in your style object. I gave an example in this answer. The linked answer only changes the icon based on term rather than changing the marker size, but the principle's the same. Let me know if I can be of more help.

Edit: Sorry, I hadn't looked at your example when answering. That map doesn't involve clustering, so I think you can do it purely via the GUI. First you need to get the number as a field in Views and then use the appropriate placeholder (which you can see when you preview the data overlay display of the view) in the pointRadius field of the map's style.

Details

  1. Make sure that the report count is a field in the OpenLayers Data Overlay display of your view.
  2. Look at the preview of this display and note down the placeholder for the field - something like ${field_report_count}.
  3. Go to Structure -> OpenLayers -> Maps and edit the appropriate map.
  4. Go to Layers & Styles, scroll down to OVERLAY LAYERS and look for the line which starts with the name of your view (it should end with - OpenLayers Data Overlay). Note down the name of the style in the STYLE column.
  5. Go to Structure -> OpenLayers -> Styles and edit the style you noted down from step 4.
  6. Put the field name you noted down from step 2. in the fields pointRadius and label. (I've never used the label field but I assume it does what you want.) You can also change the labelAllign, labelXOffset and labelYOffset fields if you want.
6
  • Thanx for the answer , I don't want to change the markup , but just the radius , if you inspect the code of reliefweb.int , they are changing just the r="" attribute of circle markup : <circle id="OpenLayers.Geometry.Point_103" r="13" ....></circle>
    – sel_space
    Jun 19, 2012 at 16:03
  • @sel_space I understood that, was hoping you could take the principle and extend: instead of modifying externalGraphic you want to modify pointRadius.
    – Andy
    Jun 19, 2012 at 16:07
  • Thank you for help , I'm looking for a simple solution because I don't have good level with javascript , I've juste looked at the code of managingnews (drupal distribution) , they are doing it with a small code
    – sel_space
    Jun 19, 2012 at 16:17
  • Also , I don't see the relation between the point and it's popup because the count appear in popup
    – sel_space
    Jun 19, 2012 at 16:58
  • @sel_space I've updated my answer.
    – Andy
    Jun 19, 2012 at 18:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.