1 (edited by namwebs 26-02-2016 14:16:37)

Topic: Maps don't display if there are multiple panels on a page

Hi,

I can't find useful documentation on this.

I have a panel page with several panels. Each one has a report grid and an associated map. Each one displays correctly if it is the only panel enabled. However if more than one is enabled, none of the maps display.  I see that all the maps have the same <div id="map"> - is this the problem? I tried putting each one in a custom block but that didn't make any difference. There are no error messages in the warehouse log file or Drupal log file either.

Related question - how to show a map with all data points and not show the report grid? (Other than hiding the grid with css). All the documentation assumes you make the grid and then use the "'sendOutputToMap'=>true" option. What if I just want the map?

Thanks for any advice/links.

2

Re: Maps don't display if there are multiple panels on a page

Hi

Multiple divs with the same id sounds very likely to be a source of problems. I'd be thinking that would cause the javascript a lot of confusion which would only generate errors within the browser. The server processes would have no idea this was happening and would not log any errors.

I'm presuming from your question that you are using the "Reporting page (customisable)".

Inspecting the code I see there is an undocumented option for the map_panel() in client_helpers/map_helper called divId. Setting

@divId=namweb

under the [map] section of the Form Structure does allow us to control the name of the map div. This may allow you to get your maps working. However, they will all appear inside divs with a hard-coded name of 'map-container'. This is not very clever but browsers may be kind enough to overlook this.

To not show the report grid I would have expected just to remove the [report_grid] section from the Form Structure. However, when I do this the map shows no records.

You say

All the documentation assumes you make the grid and then use the "'sendOutputToMap'=>true" option.

Where do you see this? That option defaults to false and it is not immediately obvious to me that it is being set to true.

A possible workaround would be to use the Report Map form instead as that is designed for outputting a map alone.

Jim Bacon.

3 (edited by namwebs 29-02-2016 07:45:15)

Re: Maps don't display if there are multiple panels on a page

Hi Jim,

Thank you for your reply.

Sorry, I wasn't clear: my page is a page created from Admin > Structure > Pages > Add new panel page, rather than from adding an Indicia report. I can't find a report option "Reporting page (customisable)" anywhere. Is this an option under Create Indicia pages > Form Selection and if so does this mean my Indicia module/s are out of date? If I use the Report Map form how would I get more than one map on a page? I need to have a summary page per species that shows several maps - one for each data type (in my case these would include atlasing data, museum specimen data etc.)

I was basing my code in the panel on http://indicia-docs.readthedocs.org/en/ … ight=panel (except based on an xml report file and combining the report_helper and grid_helper code into one panel region).

I'll attach a file for clarification.

Alice

Post's attachments

panel page.docx 650.5 kb, 1 downloads since 2016-02-29 

You don't have the permssions to download the attachments of this post.

4

Re: Maps don't display if there are multiple panels on a page

Hi Alice,

That makes things lots clearer! I realised you had a panels page but I assumed you were using panels to assemble content from several different Indicia pages created as separate nodes. I've just had a play at doing that, as it would avoid the need for writing any code, but I got lots of JavaScript errors.

The "Reporting page (customisable)" I refer to is called the "Dynamic Report Explorer" in your version of the code. I use the development code from GitHub.

Let's return to your original question then, based upon the code example you are using. To get the data for each map but without the need for a grid, you can replace the call to report_helper::report_grid() with report_helper::report_map().

To wire up each report to each map... ahh... it looks to me like the code has been written in the assumption of there being only one map to a page.

Sorry. I think we are stuck again where you have envisaged something that cannot be built without some development work.

An alternative to multiple maps might be to try multiple layers on one map I suppose.

Jim Bacon.

5 (edited by namwebs 01-03-2016 07:25:11)

Re: Maps don't display if there are multiple panels on a page

Hi,

I hadn't tried the option of adding content from different Indicia pages created as separate nodes - that's exactly what I want to do. But, yes, it works perfectly when one node is shown at a time but not when more than one is shown.

What do you suggest is the best way to show multiple layers on one map and to be able to query each layer separately? I've tried Distribution 1 map to show one distribution layer and multiple other geoserver layers. It says it features clicking on the data points to see details but I haven't got the Click to Query Occurrences bit working yet. Or the Dynamic Report Explorer which says it can contain a map and several reports - does this mean you can have several xml reports, each data set as a separate queryable layer? Would I structure one report to pull in several data sets or somehow specify several reports? Or is there another approach which would be better?

Any quick thoughts?

Thanks, Alice

6

Re: Maps don't display if there are multiple panels on a page

Hi Alice,

My look at the code yesterday, which is completely new to me and not well commented, left me with the impression that the dynamic report explorer would suffer from the same problem that we were having with the multiple maps; that all of the features from all the reports appear to be added to a single, global, report layer. I'd like to feel more authoritative on the subject but that would take a lot more effort.

There is a Distribution 3 map which supports 3 layers which might be enough to get you round this current difficulty.

Regarding the click to query, see this thread, http://forums.nbn.org.uk/viewtopic.php?id=6059%29

Jim Bacon.

7

Re: Maps don't display if there are multiple panels on a page

Hi Jim,

Thanks  - Distribution 3 map looks like the best of the available options then. I will see if this will work. Many thanks for all your assistance.

Alice