All my clusters show double the count they should.

Popups list each row, then repeats the entire list. So each node appears twice in the popup.

I don't actually know if the problem exists without clustering, because without clustering if two points are appearing directly over each other there's no way to know. (Right?)

The other displays of my view show the correct number of rows. The view preview of my overlay also shows the correct number.

Comments

Pol’s picture

Oh that's strange.

Could you tell us which JS files are loaded ? (the one related to OpenLayers of course).

Thanks

Dave Cohen’s picture

For completeness, here's all the .js included in my html head. Is that what you're asking?

  <script type="text/javascript" src="https://work.electricgroups.com/dave/sunflower7/htdocs/profiles/custom/modules/devel/jquery-1.4.4-uncompressed.js?v=1.4.4"></script>
<script type="text/javascript" src="https://work.electricgroups.com/dave/sunflower7/htdocs/misc/jquery.once.js?v=1.2"></script>
<script type="text/javascript" src="https://work.electricgroups.com/dave/sunflower7/htdocs/misc/drupal.js?mklo6z"></script>
<script type="text/javascript" src="https://work.electricgroups.com/dave/sunflower7/htdocs/misc/jquery.cookie.js?v=1.0"></script>
<script type="text/javascript" src="https://work.electricgroups.com/dave/sunflower7/htdocs/modules/contextual/contextual.js?v=1.0"></script>
<script type="text/javascript" src="https://work.electricgroups.com/dave/sunflower7/htdocs/profiles/custom/modules/fb-4/fb.js?mklo6z"></script>
<script type="text/javascript" src="https://work.electricgroups.com/dave/sunflower7/htdocs/sites/all/modules/eol/eol.js?mklo6z"></script>
<script type="text/javascript" src="https://work.electricgroups.com/dave/sunflower7/htdocs/profiles/custom/libraries/superfish/jquery.hoverIntent.minified.js?mklo6z"></script>
<script type="text/javascript" src="https://work.electricgroups.com/dave/sunflower7/htdocs/profiles/custom/libraries/superfish/jquery.bgiframe.min.js?mklo6z"></script>
<script type="text/javascript" src="https://work.electricgroups.com/dave/sunflower7/htdocs/profiles/custom/libraries/superfish/superfish.js?mklo6z"></script>
<script type="text/javascript" src="https://work.electricgroups.com/dave/sunflower7/htdocs/profiles/custom/libraries/superfish/supersubs.js?mklo6z"></script>
<script type="text/javascript" src="https://work.electricgroups.com/dave/sunflower7/htdocs/profiles/custom/libraries/superfish/supposition.js?mklo6z"></script>
<script type="text/javascript" src="https://work.electricgroups.com/dave/sunflower7/htdocs/profiles/custom/libraries/superfish/sftouchscreen.js?mklo6z"></script>
<script type="text/javascript" src="https://work.electricgroups.com/dave/sunflower7/htdocs/profiles/custom/libraries/superfish/sfsmallscreen.js?mklo6z"></script>
<script type="text/javascript" src="https://work.electricgroups.com/dave/sunflower7/htdocs/profiles/custom/modules/superfish/superfish.js?mklo6z"></script>
<script type="text/javascript" src="https://work.electricgroups.com/dave/sunflower7/htdocs/profiles/custom/modules/devel/devel_krumo_path.js?mklo6z"></script>
<script type="text/javascript" defer="defer" src="https://work.electricgroups.com/dave/sunflower7/htdocs/profiles/custom/modules/admin_menu/admin_menu.js?mklo6z"></script>
<script type="text/javascript" src="https://work.electricgroups.com/dave/sunflower7/htdocs/profiles/custom/modules/openlayers/js/openlayers.js?mklo6z"></script>
<script type="text/javascript" src="https://work.electricgroups.com/dave/sunflower7/htdocs/profiles/custom/libraries/openlayers/OpenLayers.debug.js?mklo6z"></script>
<script type="text/javascript" src="https://work.electricgroups.com/dave/sunflower7/htdocs/profiles/custom/modules/openlayers/plugins/layer_types/openlayers_layer_type_google.js?mklo6z"></script>
<script type="text/javascript" src="//maps.google.com/maps/api/js?sensor=false&amp;v=3.5"></script>
<script type="text/javascript" src="https://work.electricgroups.com/dave/sunflower7/htdocs/profiles/custom/modules/proj4js/js/proj4js.js?mklo6z"></script>
<script type="text/javascript" src="https://work.electricgroups.com/dave/sunflower7/htdocs/profiles/custom/modules/proj4js/lib/proj4js/lib/proj4js-compressed.js?mklo6z"></script>
<script type="text/javascript" src="https://work.electricgroups.com/dave/sunflower7/htdocs/profiles/custom/modules/openlayers/plugins/behaviors/openlayers_behavior_keyboarddefaults.js?mklo6z"></script>
<script type="text/javascript" src="https://work.electricgroups.com/dave/sunflower7/htdocs/profiles/custom/modules/openlayers/plugins/behaviors/openlayers_behavior_navigation.js?mklo6z"></script>
<script type="text/javascript" src="https://work.electricgroups.com/dave/sunflower7/htdocs/profiles/custom/modules/openlayers/plugins/behaviors/openlayers_behavior_panzoombar.js?mklo6z"></script>
<script type="text/javascript" src="https://work.electricgroups.com/dave/sunflower7/htdocs/profiles/custom/modules/openlayers/plugins/behaviors/openlayers_behavior_zoomtolayer.js?mklo6z"></script>
<script type="text/javascript" src="https://work.electricgroups.com/dave/sunflower7/htdocs/profiles/custom/modules/openlayers/plugins/behaviors/openlayers_behavior_dragpan.js?mklo6z"></script>
<script type="text/javascript" src="https://work.electricgroups.com/dave/sunflower7/htdocs/profiles/custom/modules/openlayers/modules/openlayers_views/plugins/layer_types/openlayers_views_vector.js?mklo6z"></script>
<script type="text/javascript" src="https://work.electricgroups.com/dave/sunflower7/htdocs/profiles/custom/modules/openlayers/plugins/behaviors/openlayers_behavior_cluster.js?mklo6z"></script>
<script type="text/javascript" src="https://work.electricgroups.com/dave/sunflower7/htdocs/profiles/custom/modules/openlayers/plugins/behaviors/openlayers_behavior_mouseposition.js?mklo6z"></script>
<script type="text/javascript" src="https://work.electricgroups.com/dave/sunflower7/htdocs/profiles/custom/modules/openlayers/plugins/behaviors/openlayers_behavior_popup.js?mklo6z"></script>
<script type="text/javascript" src="https://work.electricgroups.com/dave/sunflower7/htdocs/sites/all/themes/theme740/js/theme740.core.js?mklo6z"></script>
<script type="text/javascript" src="https://work.electricgroups.com/dave/sunflower7/htdocs/sites/all/themes/theme740/js/jquery.loader.js?mklo6z"></script>
<script type="text/javascript" src="https://work.electricgroups.com/dave/sunflower7/htdocs/sites/all/themes/theme740/js/jquery.mobilemenu.js?mklo6z"></script>
Dave Cohen’s picture

Also, I can see my points listed in jQuery.extend(...) that appears below the js files. I think the points appear there more than once. It's hard to parse that string. It's long and not displayed well. If I can pretty print it, I will post to this thread.

Pol’s picture

jsbeautifier.org :-)

Dave Cohen’s picture

jsbeautifier very handy. Thanks.

So, with that, I think its safe to say the point is in fact listed twice in the layer. So probably not a bug in the JS, but on the server side. Still I don't get why my table display shows only one row, but the layer shows two.

Again, when I preview the view, I see only one. But on the real page, I get two.

Here's a chunk of the beautified settings where the point is duplicated.

"layers": {
                      "search_observations_openlayers_1": {
                          "layer_type": "openlayers_views_vector",
                          "layer_handler": "openlayers_views_vector",
                          "projection": "EPSG:4326",
                          "isBaseLayer": false,
                          "vector": true,
                          "type": "Vector",
                          "url": [],
                          "options": [],
                          "events": [],
                          "views": {
                              "view": "search_observations",
                              "display": "openlayers_1"
                          },
                          "features": [{
                                  "projection": "EPSG:4326",
                                  "attributes": {
                                      "name_rendered": "\u003Ca href=\u0022\/dave\/sunflower7\/htdocs\/user\/superadmin\u0022 title=\u0022View user profile.\u0022 class=\u0022username\u0022 xml:lang=\u0022\u0022 about=\u0022\/dave\/sunflower7\/htdocs\/user\/superadmin\u0022 typeof=\u0022sioc:UserAccount\u0022 property=\u0022foaf:name\u0022\u003Esuperadmin\u003C\/a\u003E",
                                      "name": "\u003Ca href=\u0022\/dave\/sunflower7\/htdocs\/node\/1002009\u0022\u003EObservation by superadmin on 03-28-2013 in Salt Lake\u003C\/a\u003E",
                                      "field_sunflower_obs_time_start_rendered": "\u003Cspan class=\u0022date-display-single\u0022 property=\u0022dc:date\u0022 datatype=\u0022xsd:dateTime\u0022 content=\u00222013-03-28T10:45:00-07:00\u0022\u003EThu, 03\/28\/2013 - 10:45\u003C\/span\u003E",
                                      "field_sunflower_obs_time_start": "\u003Cspan class=\u0022date-display-single\u0022 property=\u0022dc:date\u0022 datatype=\u0022xsd:dateTime\u0022 content=\u00222013-03-28T10:45:00-07:00\u0022\u003EThu, 03\/28\/2013 - 10:45\u003C\/span\u003E",
                                      "field_sunflower_obs_type_rendered": null,
                                      "field_sunflower_obs_type": null,
                                      "title_1_rendered": "\u003Ca href=\u0022\/dave\/sunflower7\/htdocs\/node\/1000009\u0022\u003ESalt Lake\u003C\/a\u003E",
                                      "title_1": "Salt Lake",
                                      "field_sunflower_geo_rendered": "POINT (-111.88476372652 40.73393813696)",
                                      "field_sunflower_geo": "POINT (-111.88476372652 40.73393813696)",
                                      "title_rendered": "\u003Ca href=\u0022\/dave\/sunflower7\/htdocs\/node\/1002009\u0022\u003EObservation by superadmin on 03-28-2013 in Salt Lake\u003C\/a\u003E",
                                      "title": "Observation by superadmin on 03-28-2013 in Salt Lake"
                                  },
                                  "style": null,
                                  "wkt": "POINT (-111.88476372652 40.73393813696)"
                              }, {
                                  "projection": "EPSG:4326",
                                  "attributes": {
                                      "name_rendered": "\u003Ca href=\u0022\/dave\/sunflower7\/htdocs\/user\/superadmin\u0022 title=\u0022View user profile.\u0022 class=\u0022username\u0022 xml:lang=\u0022\u0022 about=\u0022\/dave\/sunflower7\/htdocs\/user\/superadmin\u0022 typeof=\u0022sioc:UserAccount\u0022 property=\u0022foaf:name\u0022\u003Esuperadmin\u003C\/a\u003E",
                                      "name": "\u003Ca href=\u0022\/dave\/sunflower7\/htdocs\/node\/1002009\u0022\u003EObservation by superadmin on 03-28-2013 in Salt Lake\u003C\/a\u003E",
                                      "field_sunflower_obs_time_start_rendered": "\u003Cspan class=\u0022date-display-single\u0022 property=\u0022dc:date\u0022 datatype=\u0022xsd:dateTime\u0022 content=\u00222013-03-28T10:45:00-07:00\u0022\u003EThu, 03\/28\/2013 - 10:45\u003C\/span\u003E",
                                      "field_sunflower_obs_time_start": "\u003Cspan class=\u0022date-display-single\u0022 property=\u0022dc:date\u0022 datatype=\u0022xsd:dateTime\u0022 content=\u00222013-03-28T10:45:00-07:00\u0022\u003EThu, 03\/28\/2013 - 10:45\u003C\/span\u003E",
                                      "field_sunflower_obs_type_rendered": null,
                                      "field_sunflower_obs_type": null,
                                      "title_1_rendered": "\u003Ca href=\u0022\/dave\/sunflower7\/htdocs\/node\/1000009\u0022\u003ESalt Lake\u003C\/a\u003E",
                                      "title_1": "Salt Lake",
                                      "field_sunflower_geo_rendered": "POINT (-111.88476372652 40.73393813696)",
                                      "field_sunflower_geo": "POINT (-111.88476372652 40.73393813696)",
                                      "title_rendered": "\u003Ca href=\u0022\/dave\/sunflower7\/htdocs\/node\/1002009\u0022\u003EObservation by superadmin on 03-28-2013 in Salt Lake\u003C\/a\u003E",
                                      "title": "Observation by superadmin on 03-28-2013 in Salt Lake"
                                  },
                                  "style": null,
                                  "wkt": "POINT (-111.88476372652 40.73393813696)"
                              }
                          ],
                          "title": "Observations",
                          "weight": 0
                      },
Dave Cohen’s picture

I suspect my data appears twice in the js settings because openlayers module calls drupal_add_js twice for my map. Drupal later does a deep merge of the javascript settings that doubles the points.

Here's a stack trace the first time openlayers calls drupal_add_js...

file:///srv/work.electricgroups.com/dave/sunflower7/profiles/custom/modules/openlayers/openlayers.module:283 openlayers_render_map_data
file:///srv/work.electricgroups.com/dave/sunflower7/profiles/custom/modules/openlayers/openlayers.module:337 openlayers_render_map
file:///srv/work.electricgroups.com/dave/sunflower7/profiles/custom/modules/openlayers/modules/openlayers_views/views/openlayers_views_style_map.inc:56 openlayers_views_style_map->query
file:///srv/work.electricgroups.com/dave/sunflower7/profiles/custom/modules/views/includes/view.inc:1037 view->build
file:///srv/work.electricgroups.com/dave/sunflower7/profiles/custom/modules/views/plugins/views_plugin_display_page.inc:216 views_plugin_display_page->execute
file:///srv/work.electricgroups.com/dave/sunflower7/profiles/custom/modules/views/includes/view.inc:1345 view->execute_display
file:///srv/work.electricgroups.com/dave/sunflower7/profiles/custom/modules/views/views.module:528 views_page
file:///srv/work.electricgroups.com/dave/sunflower7/htdocs/includes/menu.inc:517 call_user_func_array
file:///srv/work.electricgroups.com/dave/sunflower7/htdocs/includes/menu.inc:517 menu_execute_active_handler
file:///srv/work.electricgroups.com/dave/sunflower7/htdocs/index.php:21 {main}

And later in the same page request...

file:///srv/work.electricgroups.com/dave/sunflower7/profiles/custom/modules/openlayers/openlayers.module:283 openlayers_render_map_data
file:///srv/work.electricgroups.com/dave/sunflower7/profiles/custom/modules/openlayers/openlayers.module:337 openlayers_render_map
file:///srv/work.electricgroups.com/dave/sunflower7/profiles/custom/modules/openlayers/modules/openlayers_views/views/openlayers_views_style_map.inc:70 openlayers_views_style_map->render
file:///srv/work.electricgroups.com/dave/sunflower7/profiles/custom/modules/views/theme/theme.inc:49 template_preprocess_views_view
file:///srv/work.electricgroups.com/dave/sunflower7/htdocs/includes/theme.inc:1112 theme
file:///srv/work.electricgroups.com/dave/sunflower7/profiles/custom/modules/views/plugins/views_plugin_display.inc:2605 views_plugin_display->render
file:///srv/work.electricgroups.com/dave/sunflower7/profiles/custom/modules/views/includes/view.inc:1264 view->render
file:///srv/work.electricgroups.com/dave/sunflower7/profiles/custom/modules/views/plugins/views_plugin_display_page.inc:229 views_plugin_display_page->execute
file:///srv/work.electricgroups.com/dave/sunflower7/profiles/custom/modules/views/includes/view.inc:1345 view->execute_display
file:///srv/work.electricgroups.com/dave/sunflower7/profiles/custom/modules/views/views.module:528 views_page
file:///srv/work.electricgroups.com/dave/sunflower7/htdocs/includes/menu.inc:517 call_user_func_array
file:///srv/work.electricgroups.com/dave/sunflower7/htdocs/includes/menu.inc:517 menu_execute_active_handler
file:///srv/work.electricgroups.com/dave/sunflower7/htdocs/index.php:21 {main}

That's all I've managed to figure out so far. Anything in those traces jump out at you?

Is this because my overlay and map are both displays on the same view?

Dave Cohen’s picture

Component: OL Behaviors » OL Views

The problem may be related to code in openlayers_views_style_map.inc. Both query() and render() call openlayers_render_map()!

query has a cryptic comment "override to make sure this doesn't get run" On my system, it is getting run!

I commented out lines in query() below. I confirmed, with these lines commented out my map shows the proper number of points.

  /**                                                                                                               
   * Query - override to make sure this doesn't get run                                                             
   */
  function query() {
    if (isset($this->view->query->fields)) {
      $this->view->query->fields = array();
    }
    $this->view->executed = TRUE;                                                                                   
    $this->view->result = TRUE;
    // These lines commented out by Dave to avoid double render bug.                                                
    //$map = openlayers_map_load($this->options['map']);                                                            
    //$render = openlayers_render_map($map, $map->name);                                                            
    //$this->view->result = $render || !$map->data['hide_empty_map'] ? TRUE : FALSE;                                
  }

  /**                                                                                                               
   * Renders views (map)                                                                                            
   */
  function render() {
    // Get selected map                                                                                             
    $map = openlayers_map_load($this->options['map']);

    return theme($this->theme_functions(), array(
      'view' => $this->view,
      'options' => $this->options,
      'map' => openlayers_render_map($map, $map->name)
    ));
  }

I'm not suggesting that commenting out those lines is the proper fix. Just sharing what I've tracked down. Any idea what the right fix should be?

gunwald’s picture

Commenting out these lines worked for me too. I did not see any site effects.

Pol’s picture

Hi all,

I just committed a fix for it, could you test and report feedback please ?

Thanks !

Dave Cohen’s picture

Status: Active » Fixed

That works. Thanks.

gunwald’s picture

Can't test the commit, the dev isn't working for me. I get:

HTTP-Fehler 500 (Internal Server Error):

on every page where a map is included.

The strange thing is, that I did not see any log message.

Pol’s picture

Interesting, do you have any error in the log ?

(tail -f /var/log/apache2/error_log)

gunwald’s picture

No, I can't find anything that has something to do with Openlayers.

Pol’s picture

This is weird, you should have an error somewhere.

Did you checked in the wecent log messages (admin/reports/dblog) ?

gunwald’s picture

Could not find any log messages in admin/reports/dblog? That came from Openlayers.

But, after I have deleted all files of the module, restored the database (for some reason the update to the dev broke my views), redownloaded the dev, cleared the cache, it works again. Sorry for making much noise here.

Seems, that the problem with the double rendered entities is gone.

Thanks
Gunwald

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jamix’s picture

#9 also worked for me, thanks.

juantxo_kupul’s picture

#9 also worked for me

pvaling’s picture

Version: 7.x-2.x-dev » 7.x-2.0-beta9
Issue summary: View changes

Duplicates are still broken in 7.x-2.0-beta9. render() is called twice.

imshuffling’s picture

Yeah i am getting the same, tried upgrading to dev branch with no luck.

Pol’s picture

I need help on this bug please!

stefank’s picture

Hi all,

I narrow down the problem. When an user has the permission "Use contextual links" then the point is showing as duplicate. This is only for map overlay using clusters.