Hello,
I have in total roughly 5k location points with their relevant nodes. I have used the module to display those points with OL divided in 6 views.
I am viewing the entire node info when a user clicks on a point on the map and but the information which I show are Location Name, Street, Additional.

The nodes take quite a while to load and every so often do not load at all due to timeouts. It would be great if I could get some suggestion of improving the performance of my map or be pointed to the right direction.

Thanks.

PS. This is what is generated for a single point in the view:


{
  "type" : "FeatureCollection",
  "features" : [
    {
      "type" : "Geometry",
      "geometry" : {
        "type" : "Point",
        "coordinates" : [
          33.861448,
          28.147438
        ]
      },
      "properties" : {
        "name" : "",
        "description" : "<div id=\"node-105013\" class=\"node node-mapmarker contextual-links-region clearfix\" about=\"/en/node/105013\" typeof=\"sioc:Item foaf:Document\">\n\n <h2 property=\"dc:title\" datatype=\"\">\n <a href=\"/en/node/105013\">105013</a>\n </h2>\n \n \n <div class=\"content clearfix\">\n <h3 class=\"location-locations-header\">Location</h3>\n <div class=\"location-locations-wrapper\">\n <div class=\"location vcard\">\n <div class=\"adr\">\n <span class=\"fn\">THIS IS THE LOCATION NAME</span>\n <div class=\"street-address\">\n THIS IS THE ADDRESS </div>\n <span class=\"locality\">THIS IS THE CITY</span>, <span class=\"region\">THIS IS THE REGION</span>\n <span class=\"postal-code\">112233</span>\n </div>\n </div>\n </div>\n </div>\n\n \n \n</div>\n",
        "street" : "THIS IS THE ADDRESS",
        "street_rendered" : "THIS IS THE ADDRESS<br />THIS IS THE ADDITIONAL",
        "title" : "THIS IS THE LOCATION NAME",
        "title_rendered" : "<a href=\"/el/node/105013\">THIS IS THE LOCATION NAME</a>"
      }
    },

Comments

p4ul’s picture

Have you tried using the bounding box strategy? It will only load points within the current limits of the map you are looking at but when you drag the view around or zoom in it will update via ajax.
I currently have it successfully working with all the points for New Zealand (around 67k)
This will not work if you want to show all 5K at one time (I have currently limited my view to 200) but it can work if you use clustering and make the user zoom in to choose a point.

gc23’s picture

Thanks for the input,

I have thought about the bounding box strategy, but I don't think it will cover my needs. I am already using clustering so, not all points are actually shown on the map. In this way when the user clicks on a point he can see a list of the points that are clustered with their relevant info, so this is something that I would l like to keep.

dasjo’s picture

jeffschuler’s picture

@gc23: As @zzolo indicated in the similar issue you raised in the OL queue (#1392892: Bounding Box strategy and the Views GeoJSON module), your browser simply isn't going to be able to handle that many features effectively.

The Bounding Box strategy is an option I'd recommend trying, as @p4ul suggests. And your feedback on how well it works with [client-side] clustering would be much appreciated.

As @dasjo indicates, server-side clustering will help your situation out a lot; your help with #1547610: Plan server-side geo clustering for drupal 7 would be awesome.

becw’s picture

I ran into this as well. I don't expect rendering 1000-5000 records to be super-fast, but the way that the JSON output is rendered prevents caching, which is crucial in this situation. Any and all Drupal-based caching is impossible, because Drupal execution is not allowed to finish. Using "views api mode" should theoretically allow Drupal to finish execution and cache the output, but it ends up outputting HTML instead of JSON.

'feed' views displays are more appropriate than 'page' displays for this sort of JSON output. Changing the views_geojson style plugin so that is is based on a feed display instead of a page display fixes the caching issues. Unfortunately, this breaks existing 'page' displays, so perhaps a 'page' display should be left in for backwards compatibility.

Here's a patch that implements this. I've left support for 'page' displays so that existing views will not break. This also requires a patch to OpenLayers, attached (1608276-5-openlayers-views_geojson_use_feed.patch).

jeffschuler’s picture

Title: performance issue with many points loaded » allowing caching, & performance issues with many points

Awesome, @becw: thanks for tracking this down and patching.
Looks like you fixed a few other things along the way, too.

Grateful to anyone else who can try this out and report back. Will review when I get some free cycles.

becw’s picture

Title: allowing caching, & performance issues with many points » allowing caching, & performance issues with many points (patch)
Version: 7.x-1.0-alpha1 » 7.x-1.x-dev
Category: support » task
Priority: Normal » Major
Status: Active » Needs review
jeffschuler’s picture

Status: Needs review » Needs work

This is looking good.

Still need to check for preview mode on existing Page displays; otherwise Views barfs AJAX errors in previews:

-    if ($this->display->display_plugin == 'page' && !$this->options['using_views_api_mode']) {
+    if ($this->display->display_plugin == 'page' && !$this->options['using_views_api_mode'] && !$this->view->preview) {

Can we show a more prominent deprecation message on existing Page display views? It's a bit of hidden inside the style settings.

This will also need an update to README.txt.

Thanks @becw!

pol’s picture

I will merge this patch soon. Work in progress.

pol’s picture

Status: Needs work » Fixed

  • Pol committed 392f145 on 7.x-1.x authored by becw
    Issue #1608276 by becw | gc23: Allowing caching,...

Status: Fixed » Closed (fixed)

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

basvredeling’s picture

Priority: Major » Normal
Status: Closed (fixed) » Needs review
StatusFileSize
new1.25 KB

The README.txt still needs a small change:

USAGE
-----
1. Create a View with a Page display on content with geospatial data.
2. Add fields to output a Geofield, longitude & latitude or WKT.
3. ....

Still says "page", should be Feed, right? And the part about "views api" render mode can be scrapped completely.
Here's a quick patch.

pol’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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