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
Comment #1
p4ul commentedHave 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.
Comment #2
gc23 commentedThanks 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.
Comment #3
dasjomaybe you will be interested in #1547610: Plan server-side geo clustering for drupal 7
Comment #4
jeffschuler@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.
Comment #5
becw commentedI 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).Comment #6
jeffschulerAwesome, @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.
Comment #7
becw commentedComment #8
jeffschulerThis is looking good.
Still need to check for preview mode on existing Page displays; otherwise Views barfs AJAX errors in previews:
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!
Comment #9
polI will merge this patch soon. Work in progress.
Comment #10
polComment #13
basvredelingThe README.txt still needs a small change:
Still says "page", should be Feed, right? And the part about "views api" render mode can be scrapped completely.
Here's a quick patch.
Comment #15
pol