Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Cannot load the map(OpenStreetMap) after update

  • dqzhou
  • dqzhou's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 month 2 weeks ago - 1 month 2 weeks ago #258428 by dqzhou
Please help us help you and fill where relevant:
Your LimeSurvey version: 6.4.12
Own server or LimeSurvey hosting:
Survey theme/template:
==================
Hi,

When we check the map-related questions after version update, we notice it is difficult to load successfully. It would be not ideal for respondents. Before updating, this case did not exist. I also checked the Google map, it does not work either. 

Is it possible to solve? I attached the unloading maps. Thank you in advance!


Best regards,
dq
Last edit: 1 month 2 weeks ago by dqzhou.

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 2 weeks ago #258466 by DenisChenu
Replied by DenisChenu on topic Cannot load the map(OpenStreetMap) after update
Not related to development, i move.

I just test : no issue for me.
Can you show your browser console (F12) for error ?
 

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.

Please Log in to join the conversation.

  • dqzhou
  • dqzhou's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 month 2 weeks ago #258477 by dqzhou
Hi Denis,

I attached the Console.  

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 2 weeks ago #258497 by tpartner
I also have no problem with the OpenStreetMap.

I suspect the problem with Google is that you have an incorrect API key.

- manual.limesurvey.org/Global_settings/en#General
- developers.google.com/maps/documentation/javascript/get-api-key

Can you attache a small sample survey containing only the relevant questions?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

  • dqzhou
  • dqzhou's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 month 2 weeks ago #258503 by dqzhou
Hi Tony,

I attached the relevant question group in the end. Thank you for your check!
 

File Attachment:

File Name: limesurvey...4496.lsg
File Size:25 KB

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 2 weeks ago #258504 by tpartner
Please send a survey export (.lss file) containing only the relevant questions.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

  • dqzhou
  • dqzhou's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 month 2 weeks ago #258506 by dqzhou
Hi,

I attached the .lss file. I checked again, it is still difficult to be loaded.  

File Attachment:

File Name: limesurvey...8497.lss
File Size:35 KB

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 2 weeks ago #258507 by tpartner
The map is working but, as the question is initially hidden by relevance, the map is rendered at its smallest possible size.

You will either need to move it to another group or hide the question via CSS and use JavaScript to show it when the "indicate it on the map" checkbox is selected.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

  • dqzhou
  • dqzhou's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 month 2 weeks ago #258508 by dqzhou
Hi Tony,

If I move it to another group, it looks strange for the whole survey.

I may further ask for the JS code to show it when the checkbox is selected. Thank you very much!

Best regards,
dqzhou

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 2 weeks ago #258509 by tpartner
1) Assign the map question a CSS class "custom-hidden".

2) Place this script in the source of the checkbox question:

Code:
$(document).on('ready pjax:scriptcomplete',function(){
 
        // Identify some elements
        var thisQuestion = $('#question{QID}');
        var mapCheckbox = $(':checkbox:last', thisQuestion);
        var mapQuestion = $(thisQuestion).nextAll('.text-short:eq(0)');
 
        // Listener on the checkbox
        $(mapCheckbox).on('change', function(e) {
            handleMap();
        });
 
        // Initial state
        handleMap();
 
        // Function to handle the map visibility
        function handleMap() {
 
            if($(mapCheckbox).is(':checked')) {
                $(mapQuestion).removeClass('custom-hidden');
            }
            else {
                $(mapQuestion).addClass('custom-hidden');
            }
        };
 
    });
</script>

3) Place this CSS in the source of the checkbox question:

Code:
<style type="text/css" data-author="Tony Partner">
 
    .custom-hidden {
        position: absolute;
        left: -9999em;
    }
</style>

4) Modify the checkbox question validation to enforce a map selection if the second checkbox is selected (I left this for you to do).

Sample survey attached: 

File Attachment:

File Name: limesurvey...4971.lss
File Size:34 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 2 weeks ago #258520 by DenisChenu
Replied by DenisChenu on topic Cannot load the map(OpenStreetMap) after update

The map is working but, as the question is initially hidden by relevance, the map is rendered at its smallest possible size.

You will either need to move it to another group or hide the question via CSS and use JavaScript to show it when the "indicate it on the map" checkbox is selected.
 
If i don't make error : this issue was already fixed in 3.X
It must be reported

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose