Needs review
Project:
Get Locations
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
28 Oct 2015 at 11:37 UTC
Updated:
12 Nov 2015 at 10:18 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
drikc commentedComment #3
drikc commentedThe attached patch integrates with devel_generate module and use http://www.geonames.org/ web service to randomly get some place names and their coordinates.
The geonames webservice use a username parameter and which is set with a 'demo' string by default. Using this value may render to no response depending on it has been trigger too many times... This default username can be changed by setting the 'geonames_webservice_username_parameter' variable (a specific login can be obtain here: http://www.geonames.org/login).
Comment #6
hutch commentedPatch went in fine, tested with 10 places using the defaults and they were all created.
This has been commited to 1.x and 2.x dev.
@drikc, Thank you for this excellent contribution!
Comment #7
hutch commentedComment #8
drikc commentedThe attached patch prevent an infinite loop if the geonames web service fail for some reasons (unknown username, limit exceeded, ...).
Note, that this patch must be applied after the first one!
Comment #9
hutch commentedPatch in #8 is good and will be commited.
Comment #10
drikc commentedSmall add-on over patch #8; it fill in also the country column (in addition to name, lat and lng colunmns).
Comment #11
hutch commentedI've just had a look at the geonames API to see just what exactly gets returned, 'countryCode' is fine, it is uppercase which is what we want.
I also see a field 'asciiName' which will print in any language, the 'name' field could contain characters unique to the country. Does anyone have any thoughts on this?
eg
Comment #12
drikc commentedReading http://download.geonames.org/export/dump/readme.txt we have the following definitions for fields:
name : name of geographical point (utf8) varchar(200)
country code : ISO-3166 2-letter country code, 2 characters
Comment #13
hutch commentedOK, most browsers support utf8 and the db should too so keep 'name'.