Check out the LimeSurvey source code on GitHub!

Ability to add Google Maps as a question

More
5 years 10 months ago #59554 by gacquier
Hi,

I read on This change list page

Changes from 1.90 to 1.91beta (build 9631)
(...)
+New feature: Ability to add Google Maps as a question (parajulik)


Along with some other references to google maps API deals.

However, I could not figure out how to activate this "ability".

Would any one of you know what it's all about ?

Thanks in advance for your awnsers :) !

Please Log in to join the conversation.

More
5 years 10 months ago #59587 by DenisChenu
:laugh:

I found it now : short text

(in french : texte court)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).

Please Log in to join the conversation.

More
5 years 10 months ago #59820 by gacquier
Great, short text is the place to find it.

For my solution to work, I needed to modify survey_runtime.js to add map.enablegooglebar after the GMAP2 instanciation.

Thanks a lot for helping me !
GĂ©raud

Please Log in to join the conversation.

More
5 years 9 months ago - 5 years 9 months ago #61762 by transportation_researcher
Hi,

I've been searching all over the web to use this feature and still don't know how to enable it.

I would like to add google maps into a question where respondents can pin point their frequent locations and provide me a reading of the longitude/latitudes of the selected points.

I'm having difficulties trying to utilize this feature and it may be because of my lack of experience using javascript and APIs. Is there documentation that'll show me how to insert the Google Map API script into the advance editing question box and record lat/longs.

Do I find this in Short text? (I checked out the website and don't understand what its used for or how it will help me)

What is GMAP2 instantiation?

Why and where do I modify survey settings to allow for google maps to be embedded in the questions?

For my solution to work, I needed to modify survey_runtime.js to add map.enablegooglebar after the GMAP2 instanciation.


This feature would be very useful for me and any help would be great!
Thanks in Advance
Last Edit: 5 years 9 months ago by transportation_researcher.

Please Log in to join the conversation.

More
5 years 9 months ago #61764 by transportation_researcher
I am using Version 1.91 if this needs to be known

Please Log in to join the conversation.

More
5 years 9 months ago #61765 by transportation_researcher
I figured out what short text means in this topic, duh!

I've tried using the map service feature and I'm not getting anything when testing the question. Since I've just figured this out, it may just take me some time to play around with the settings and making sure I have the right plug-ins.

Again any suggestions or hints would be useful.

Please Log in to join the conversation.

More
5 years 9 months ago #61767 by gacquier
Hi transportation researcher !

In the general parameters (the tools button on the upper part of the screen, you will find a place to paste your google maps API key.

Then, create a short text question.
You should find an "advanced parameters" section in the question parameters. In this section, you will find an option like "use map service". Other options let you define the map size, etc... The default place field has to be filled with the defaut LAT/LON position, like 44.8403 2.4609 for example.

I hope this will be helpful.
I am off this week end, don't be surprised to have more help.

Good luck :-)
Another transportation research

PS : the solution I propose dealing with changing some code is just a way to look for a place before placing the pin. I guess it's not usefull in your case.
:)

Please Log in to join the conversation.

More
5 years 8 months ago #61893 by transportation_researcher
Thanks gacquier!

I got the map service working now. The issue was Internet Explorer was not allowing the API to function in a secured site (https://). Everytime I tested the page I got a warning message asking if I want to view content that was delivered securely (e.g. not the Google Map API). Because of habit, I don't read security messages and always just click yes. After reading the warning more carefully and what it means exactly, I gave myself a palm to the forehead.
This may be an issue when I administer the survey to the participants. I may add a message before the question page to tell them to click no to utilize the mapping service.

I would like to follow your direction in changing the code so that participants would be able to add a postal address before placing a pin. Is that pretty easy to do? I've been searching in how to modify the survey_runtime.js and seeing if I can mimic your steps, but I'm not having any luck. If this requires turning off the XSS filter then I would not be able to do so because I'm not a "super administrator". Again thanks for your help!

~lance

Please Log in to join the conversation.

More
5 years 8 months ago #61946 by tpartner
To enable the Google Search in the map:

In /scripts/survey_runtime.js, find this line
map.addControl(new GSmallMapControl());

And add this line right after it
map.enableGoogleBar();

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: mfpereira

Please Log in to join the conversation.

More
4 years 7 months ago #83669 by jmorant
Hi everybody,

This is an old post but I fits quite well to what I'm looking for.

I want to enable a search field to the map so I can write the address I want to be geocoded. I'm working in a project in which we use limesurvey through Android Tablets and it's quite difficult to navegate through the map without this "search field".

I'm trying to add the line of code that "tpartner" said but I can't find :
map.addControl(new GSmallMapControl());
in /scripts/survey_runtime.js

I'm using Limesurvey 1.92+.

Thank you so much.

Please Log in to join the conversation.

More
4 years 7 months ago #83671 by gacquier
Our installation was on Version 1.91RC6 Build 9986...

Not sure if it's the same solution in later versions...

Please Log in to join the conversation.

More
4 years 7 months ago - 4 years 7 months ago #83683 by tpartner
As far as I know, for V3 of the maps API, there is no googleBar available.

Some insight here - code.google.com/p/gmaps-api-v3-googlebar/

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last Edit: 4 years 7 months ago by tpartner.

Please Log in to join the conversation.

More
3 years 10 months ago #94561 by mfpereira
I have the same problem.

I don't find the line.

Thanks

Please Log in to join the conversation.

More
3 years 10 months ago #94572 by tpartner
As mentioned, this is not available with V3 of the maps API.

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.

More
3 years 10 months ago #94681 by mfpereira
Ok sorry.

So I can't add that option to my survey?
If a could switch the information from lat and long to the zip code it would be useful.

Do you know how I can do that?

Many thanks

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form