Hi!
For our current survey we want to determine geocoordinates, (German) district and federal state names from address data we already have from our participants.
So what we have right now is a survey with a
closed participant list. Every participant has additionally
address data (street address and number, ZIP, city) in
custom attribute fields.
To get the
geocoordinates we used this solution here which works great:
www.limesurvey.org/de/community/forum/ca...d-on-previous-answer
(we placed short-text question directly before a map question and then place the script in the source of the map question):
But how can we also add district and federal state names (it can filles in into the same field with the geocoordinates, separated by a semicolon)?
The Google Maps API is able to deliver all of the necessary information (e.g.
maps.googleapis.com/maps/api/geocode/jso...13.3779&key=XXXXXXXX
<- this only works with a API key; I attached the JSON (geo.zip) you get when opening this URL). This part is relevant:
Code:
"results" : [
{
"address_components" : [
{
"long_name" : "1",
"short_name" : "1",
"types" : [ "street_number" ]
},
{
"long_name" : "Pariser Platz",
"short_name" : "Pariser Platz",
"types" : [ "route" ]
},
{
"long_name" : "Mitte",
"short_name" : "Mitte",
"types" : [ "political", "sublocality", "sublocality_level_1" ]
},
{
"long_name" : "Berlin",
"short_name" : "Berlin",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Berlin",
"short_name" : "Berlin",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "Deutschland",
"short_name" : "DE",
"types" : [ "country", "political" ]
},
{
"long_name" : "10117",
"short_name" : "10117",
"types" : [ "postal_code" ]
}
It would be great to extract the
sublocality_level_1, locality and administrative_area_level_1 info and write it into the fields right after the geocoordinates.
Any ideas how to do that?
Last but not least: We are running LimeSurvey Version 2.05+ Build 140320 (sadly the update processes at the institution I am working are a little bit complicated, so there is no chance to update to a current version).
Any help is very much appreciated!
Thanks a lot!
Hulotte