Welcome, Guest
Username: Password: Remember me

TOPIC: Ability to add Google Maps as a question

Ability to add Google Maps as a question 3 years 6 months ago #59554

  • gacquier
  • gacquier's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 18
  • Karma: 0
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 :) !
The administrator has disabled public write access.

Re: Ability to add Google Maps as a question 3 years 6 months ago #59587

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6451
  • Thank you received: 844
  • Karma: 249
:laugh:

I found it now : short text

(in french : texte court)
The administrator has disabled public write access.

Re: Ability to add Google Maps as a question 3 years 6 months ago #59820

  • gacquier
  • gacquier's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 18
  • Karma: 0
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
The administrator has disabled public write access.

Re: Ability to add Google Maps as a question 3 years 4 months ago #61762

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: 3 years 4 months ago by transportation_researcher.
The administrator has disabled public write access.

Re: Ability to add Google Maps as a question 3 years 4 months ago #61764

I am using Version 1.91 if this needs to be known
The administrator has disabled public write access.

Re: Ability to add Google Maps as a question 3 years 4 months ago #61765

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.
The administrator has disabled public write access.

Re: Ability to add Google Maps as a question 3 years 4 months ago #61767

  • gacquier
  • gacquier's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 18
  • Karma: 0
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.
:)
The administrator has disabled public write access.

Re: Ability to add Google Maps as a question 3 years 4 months ago #61893

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
The administrator has disabled public write access.

Re: Ability to add Google Maps as a question 3 years 4 months ago #61946

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4281
  • Thank you received: 807
  • Karma: 370
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.
The following user(s) said Thank You: mfpereira

Re: Ability to add Google Maps as a question 2 years 3 months ago #83669

  • jmorant
  • jmorant's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 4
  • Karma: 0
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.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.201 seconds
Donation Image