I am working on an urgent questionnaire to cover the on-going pandemic and I want users to provide their location from a Map-based Question.
I wish the map to automatically zoom to his area based on the stored device location and allow the user to fine tune his location and the updated coordinates have to be saved.
In case, the user is responding from a PC, the default IP could serve as a first guess for the location. However, the IP related Address is largely inaccurate for my little country.
I do also have a list of all localities and sub-localities.
Since the questionnaire is being generously hosted, I do not have access to the global settings.
Please guide me through for a smart solution.
I am completely new to Limesurvey and I have little programming experience.
I have already reached this step, however I wish to be able to automatically grab the device location through Javascript and the map to be centered accordingly and still allowing the user for fine tuning and the final position to be saved.
I do have the position of the device location, however the map is not reacting to zoom and center to that location. I also need the final position after manual fine tuning to be saved.
As you might have seen, tpartners script works with Google Maps.
Since some months you need a Google Maps API Key.
This you have to set in the Global Settings; but you said that you don't have access.
But with an equation you can use it with OpenStreetMap.
Example will follow in a few hours.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Example with OpenStreetMaps.
Because I am reqally not familiar with JS, I used tpartner's script, hided the question and entered the coordinates with EM into a following question that shows the OpenStreetMap.
I am sure this can be done more efficient, but it works.
Thanks for putting that effort for me. I am learning LS on fast-track to design a questionnaire for the on-going pandemic to freely assist our community and Govt.
I just imported the Survey and I changed the map from google to openstreetmap and after execution, I filled in the Survey Form from my laptop and smartphone.
Voila, its working on both.
The location data is being saved and even the hidden fields are saved (that is very smart).
The only issue is with the zoom level, I changed it from 4 to 11, however it is persisting on 4.
With an appreciable zoom level, it would better assist the user to choose a rough location.
Any suggestion to fix it?
Can the "Restrict Search Place to Map Extent" be ticked by default ?
Anyway this search field is not that useful for my little country as openstreetmap is not enough covered and there are minimum landmarks and street names, especially for the massively inhabited rural areas.
A sort of autocomplete from a file or array can be more useful. From Geonames, they do provide a list with localities with corresponding longitude and latitude. Since I do not have access to the config file, I cannot directly add options to use Geonames/Mapquest API.
In my second example there is set the zoom level to 11, and it keeps this level in my installation 3.22.2.
By the way, which version are you using? You still did not mention that.
If I change the level to 4 , I see this.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
As you might have seen in Tony's script the longitude and latitude are separated by colon.
But OpenStreetMap expects that they are separated by "blank".
In the attached example it isn't necessary anymore. The javascript part return the coords separated by "blank".
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Prior to replicate the code in my master questionnaire, I imported all 3 questions into a blank project as a test case but nothing happened after execution.