alchemy-fr / geonamesserver Goto Github PK
View Code? Open in Web Editor NEWA node Geonames server
License: Other
A node Geonames server
License: Other
On https://geonames-server.readthedocs.org, the "Fork me on Github" ribbon ponts on @csaoh repo instead of alchemy's one
Given "paris-l'hôpital" is indexed
Looking for paris-l'hopital returns 0 result
Since /ip/ route has been added
Given a city with a composed name "corbeil-essone" is indexed
Looking for "corbeil-essone" returns 0 result
When using make install, PHP curl presence is not checked, import is done (more than 30 minutes), then install fails because PHP curl is not present, angry
The current documentation on read the docs is obsolete
Hi,
Just tested the request "/ip?ip=4.23.171.0&callback=myFunction" given in the homepage and get this error on screen :
myfunction({
"error": "internal server error"
});
And this in logs :
elastic search error, got error null status code 200 and response { domain: null,
_events:
{ close: [ [Function], [Function] ],
data: [Function],
end: [ [Function], [Function: responseOnEnd] ] },
_maxListeners: 10,
socket:
{ domain: null,
_events:
{ free: [Function],
close: [Object],
agentRemove: [Function],
drain: [Function: ondrain],
error: [Object] },
_maxListeners: 10,
_handle:
{ writeQueueSize: 0,
owner: [Circular],
onread: [Function: onread] },
_pendingWriteReqs: 0,
_flags: 0,
_connectQueueSize: 0,
destroyed: false,
errorEmitted: false,
bytesRead: 5955,
_bytesDispatched: 1544,
allowHalfOpen: undefined,
_connecting: false,
writable: true,
parser:
{ _headers: [],
_url: '',
onHeaders: [Function: parserOnHeaders],
onHeadersComplete: [Function: parserOnHeadersComplete],
onBody: [Function: parserOnBody],
onMessageComplete: [Function: parserOnMessageComplete],
socket: [Circular],
incoming: [Circular],
maxHeaderPairs: 2000,
onIncoming: [Function: parserOnIncomingClient] },
_httpMessage:
{ domain: null,
_events: [Object],
_maxListeners: 10,
output: [],
outputEncodings: [],
writable: true,
_last: false,
chunkedEncoding: false,
shouldKeepAlive: true,
useChunkedEncodingByDefault: false,
sendDate: false,
_hasBody: true,
_trailer: '',
finished: true,
agent: [Object],
socketPath: undefined,
method: 'GET',
path: '/geonames_prod/cities/_search',
_headers: [Object],
_headerNames: [Object],
_header: 'GET /geonames_prod/cities/_search HTTP/1.1\r\nhost: 10.143.115.25:9200\r\ncontent-length: 1426\r\nConnection: keep-alive\r\n\r\n',
_headerSent: true,
socket: [Circular],
connection: [Circular],
parser: [Object],
res: [Circular] },
ondata: [Function: socketOnData],
onend: [Function: socketOnEnd],
_connectQueue: null,
readable: true },
connection:
{ domain: null,
_events:
{ free: [Function],
close: [Object],
agentRemove: [Function],
drain: [Function: ondrain],
error: [Object] },
_maxListeners: 10,
_handle:
{ writeQueueSize: 0,
owner: [Circular],
onread: [Function: onread] },
_pendingWriteReqs: 0,
_flags: 0,
_connectQueueSize: 0,
destroyed: false,
errorEmitted: false,
bytesRead: 5955,
_bytesDispatched: 1544,
allowHalfOpen: undefined,
_connecting: false,
writable: true,
parser:
{ _headers: [],
_url: '',
onHeaders: [Function: parserOnHeaders],
onHeadersComplete: [Function: parserOnHeadersComplete],
onBody: [Function: parserOnBody],
onMessageComplete: [Function: parserOnMessageComplete],
socket: [Circular],
incoming: [Circular],
maxHeaderPairs: 2000,
onIncoming: [Function: parserOnIncomingClient] },
_httpMessage:
{ domain: null,
_events: [Object],
_maxListeners: 10,
output: [],
outputEncodings: [],
writable: true,
_last: false,
chunkedEncoding: false,
shouldKeepAlive: true,
useChunkedEncodingByDefault: false,
sendDate: false,
_hasBody: true,
_trailer: '',
finished: true,
agent: [Object],
socketPath: undefined,
method: 'GET',
path: '/geonames_prod/cities/_search',
_headers: [Object],
_headerNames: [Object],
_header: 'GET /geonames_prod/cities/_search HTTP/1.1\r\nhost: 10.143.115.25:9200\r\ncontent-length: 1426\r\nConnection: keep-alive\r\n\r\n',
_headerSent: true,
socket: [Circular],
connection: [Circular],
parser: [Object],
res: [Circular] },
ondata: [Function: socketOnData],
onend: [Function: socketOnEnd],
_connectQueue: null,
readable: true },
httpVersion: '1.1',
complete: true,
headers:
{ 'content-type': 'application/json; charset=UTF-8',
'content-length': '5848' },
trailers: {},
readable: false,
_paused: false,
_pendings: [],
_endEmitted: false,
url: '',
method: null,
statusCode: 500,
client:
{ domain: null,
_events:
{ free: [Function],
close: [Object],
agentRemove: [Function],
drain: [Function: ondrain],
error: [Object] },
_maxListeners: 10,
_handle:
{ writeQueueSize: 0,
owner: [Circular],
onread: [Function: onread] },
_pendingWriteReqs: 0,
_flags: 0,
_connectQueueSize: 0,
destroyed: false,
errorEmitted: false,
bytesRead: 5955,
_bytesDispatched: 1544,
allowHalfOpen: undefined,
_connecting: false,
writable: true,
parser:
{ _headers: [],
_url: '',
onHeaders: [Function: parserOnHeaders],
onHeadersComplete: [Function: parserOnHeadersComplete],
onBody: [Function: parserOnBody],
onMessageComplete: [Function: parserOnMessageComplete],
socket: [Circular],
incoming: [Circular],
maxHeaderPairs: 2000,
onIncoming: [Function: parserOnIncomingClient] },
_httpMessage:
{ domain: null,
_events: [Object],
_maxListeners: 10,
output: [],
outputEncodings: [],
writable: true,
_last: false,
chunkedEncoding: false,
shouldKeepAlive: true,
useChunkedEncodingByDefault: false,
sendDate: false,
_hasBody: true,
_trailer: '',
finished: true,
agent: [Object],
socketPath: undefined,
method: 'GET',
path: '/geonames_prod/cities/_search',
_headers: [Object],
_headerNames: [Object],
_header: 'GET /geonames_prod/cities/_search HTTP/1.1\r\nhost: 10.143.115.25:9200\r\ncontent-length: 1426\r\nConnection: keep-alive\r\n\r\n',
_headerSent: true,
socket: [Circular],
connection: [Circular],
parser: [Object],
res: [Circular] },
ondata: [Function: socketOnData],
onend: [Function: socketOnEnd],
_connectQueue: null,
readable: true },
httpVersionMajor: 1,
httpVersionMinor: 1,
upgrade: false,
request:
{ domain: null,
_events:
{ error: [Function],
complete: [Function],
pipe: [Object],
end: [Object],
data: [Function] },
_maxListeners: 10,
readable: true,
writable: true,
uri:
{ protocol: 'http:',
slashes: true,
host: '10.143.115.25:9200',
port: '9200',
hostname: '10.143.115.25',
href: 'http://10.143.115.25:9200/geonames_prod/cities/_search',
pathname: '/geonames_prod/cities/_search',
path: '/geonames_prod/cities/_search' },
body: <Buffer 7b 22 73 69 7a 65 22 3a 31 2c 22 73 6f 72 74 22 3a 5b 22 5f 73 63 6f 72 65 22 5d 2c 22 66 69 65 6c 64 73 22 3a 5b 22 67 65 6f 6e 61 6d 65 69 64 22 2c 22 ...>,
callback: [Function],
pool: {},
dests: [],
__isRequestRequest: true,
_callback: [Function],
_redirectsFollowed: 0,
maxRedirects: 10,
followRedirect: true,
followAllRedirects: false,
redirects: [],
headers: { 'content-length': 1426 },
setHost: true,
originalCookieHeader: undefined,
_jar: undefined,
port: '9200',
host: '10.143.115.25',
clientErrorHandler: [Function],
_parserErrorHandler: [Function],
path: '/geonames_prod/cities/_search',
httpModule:
{ parsers: [Object],
STATUS_CODES: [Object],
IncomingMessage: [Object],
OutgoingMessage: [Object],
ServerResponse: [Object],
Agent: [Object],
globalAgent: [Object],
ClientRequest: [Object],
request: [Function],
get: [Function],
Server: [Object],
createServer: [Function],
_connectionListener: [Function: connectionListener],
Client: [Function: deprecated],
createClient: [Function: deprecated] },
agentClass: { [Function: Agent] super_: [Object], defaultMaxSockets: 5 },
agent:
{ domain: null,
_events: [Object],
_maxListeners: 10,
options: {},
requests: {},
sockets: [Object],
maxSockets: 5,
createConnection: [Function] },
_started: true,
method: 'GET',
href: 'http://10.143.115.25:9200/geonames_prod/cities/_search',
req:
{ domain: null,
_events: [Object],
_maxListeners: 10,
output: [],
outputEncodings: [],
writable: true,
_last: false,
chunkedEncoding: false,
shouldKeepAlive: true,
useChunkedEncodingByDefault: false,
sendDate: false,
_hasBody: true,
_trailer: '',
finished: true,
agent: [Object],
socketPath: undefined,
method: 'GET',
path: '/geonames_prod/cities/_search',
_headers: [Object],
_headerNames: [Object],
_header: 'GET /geonames_prod/cities/_search HTTP/1.1\r\nhost: 10.143.115.25:9200\r\ncontent-length: 1426\r\nConnection: keep-alive\r\n\r\n',
_headerSent: true,
socket: [Object],
connection: [Object],
parser: [Object],
res: [Circular] },
ntick: true,
response: [Circular],
_destdata: true,
_ended: true },
toJSON: [Function: toJSON],
req:
{ domain: null,
_events: { error: [Function], drain: [Function] },
_maxListeners: 10,
output: [],
outputEncodings: [],
writable: true,
_last: false,
chunkedEncoding: false,
shouldKeepAlive: true,
useChunkedEncodingByDefault: false,
sendDate: false,
_hasBody: true,
_trailer: '',
finished: true,
agent:
{ domain: null,
_events: [Object],
_maxListeners: 10,
options: {},
requests: {},
sockets: [Object],
maxSockets: 5,
createConnection: [Function] },
socketPath: undefined,
method: 'GET',
path: '/geonames_prod/cities/_search',
_headers: { host: '10.143.115.25:9200', 'content-length': 1426 },
_headerNames: { host: 'host', 'content-length': 'content-length' },
_header: 'GET /geonames_prod/cities/_search HTTP/1.1\r\nhost: 10.143.115.25:9200\r\ncontent-length: 1426\r\nConnection: keep-alive\r\n\r\n',
_headerSent: true,
socket:
{ domain: null,
_events: [Object],
_maxListeners: 10,
_handle: [Object],
_pendingWriteReqs: 0,
_flags: 0,
_connectQueueSize: 0,
destroyed: false,
errorEmitted: false,
bytesRead: 5955,
_bytesDispatched: 1544,
allowHalfOpen: undefined,
_connecting: false,
writable: true,
parser: [Object],
_httpMessage: [Circular],
ondata: [Function: socketOnData],
onend: [Function: socketOnEnd],
_connectQueue: null,
readable: true },
connection:
{ domain: null,
_events: [Object],
_maxListeners: 10,
_handle: [Object],
_pendingWriteReqs: 0,
_flags: 0,
_connectQueueSize: 0,
destroyed: false,
errorEmitted: false,
bytesRead: 5955,
_bytesDispatched: 1544,
allowHalfOpen: undefined,
_connecting: false,
writable: true,
parser: [Object],
_httpMessage: [Circular],
ondata: [Function: socketOnData],
onend: [Function: socketOnEnd],
_connectQueue: null,
readable: true },
parser:
{ _headers: [],
_url: '',
onHeaders: [Function: parserOnHeaders],
onHeadersComplete: [Function: parserOnHeadersComplete],
onBody: [Function: parserOnBody],
onMessageComplete: [Function: parserOnMessageComplete],
socket: [Object],
incoming: [Circular],
maxHeaderPairs: 2000,
onIncoming: [Function: parserOnIncomingClient] },
res: [Circular] },
body: '{"error":"SearchPhaseExecutionException[Failed to execute phase [query], total failure; shardFailures {[KGbdV3rHS3aiVertaRM-gA][geonames_prod][2]: SearchParseException[[geonames_prod][2]: from[-1],size[1]: Parse Failure [Failed to parse source [{\\"size\\":1,\\"sort\\":[\\"_score\\"],\\"fields\\":[\\"geonameid\\",\\"name\\",\\"asciiname\\",\\"alternatenames\\",\\"names\\",\\"countryCode\\",\\"featureClass\\",\\"featureCode\\",\\"cc2\\",\\"admin1Code\\",\\"admin2Code\\",\\"admin3Code\\",\\"admin4Code\\",\\"latitude\\",\\"longitude\\",\\"population\\",\\"DEM\\",\\"timezone\\",\\"modificationDate\\",\\"pin\\"],\\"query\\":{\\"bool\\":{\\"must\\":[{\\"terms\\":{\\"featureCode\\":[\\"ppl\\",\\"ppla\\",\\"ppla2\\",\\"ppla3\\",\\"ppla4\\",\\"pplc\\",\\"pplf\\",\\"pplg\\",\\"ppll\\",\\"pplq\\",\\"pplr\\",\\"ppls\\",\\"pplw\\",\\"pplx\\",\\"stlmt\\"],\\"minimum_match\\":1}},{\\"terms\\":{\\"countryCode\\":[\\"us\\"],\\"minimum_match\\":1}}],\\"boost\\":1,\\"should\\":[{\\"custom_filters_score\\":{\\"query\\":{\\"query_string\\":{\\"fields\\":[\\"name^3\\",\\"alternatenames\\"]}},\\"filters\\":[{\\"filter\\":{\\"numeric_range\\":{\\"population\\":{\\"from\\":\\"1000\\"}}},\\"boost\\":2},{\\"filter\\":{\\"numeric_range\\":{\\"population\\":{\\"from\\":\\"10000\\"}}},\\"boost\\":5},{\\"filter\\":{\\"numeric_range\\":{\\"population\\":{\\"from\\":\\"100000\\"}}},\\"boost\\":3},{\\"filter\\":{\\"geo_distance\\":{\\"distance\\":\\"10km\\",\\"pin.location\\":{\\"lat\\":38,\\"lon\\":-97}}},\\"boost\\":15},{\\"filter\\":{\\"geo_distance\\":{\\"distance\\":\\"200km\\",\\"pin.location\\":{\\"lat\\":38,\\"lon\\":-97}}},\\"boost\\":12},{\\"filter\\":{\\"geo_distance\\":{\\"distance\\":\\"1000km\\",\\"pin.location\\":{\\"lat\\":38,\\"lon\\":-97}}},\\"boost\\":5},{\\"filter\\":{\\"query\\":{\\"query_string\\":{\\"default_field\\":\\"name.untouched\\"}}},\\"boost\\":2},{\\"filter\\":{\\"query\\":{\\"query_string\\":{\\"default_field\\":\\"name\\"}}},\\"boost\\":5}],\\"score_mode\\":\\"multiply\\"}},{\\"prefix\\":{}},{\\"prefix\\":{}}],\\"minimum_number_should_match\\":1}},\\"highlight\\":{\\"fields\\":{\\"name\\":{}}},\\"track_scores\\":true}]]]; nested: QueryParsingException[[geonames_prod] query_string must be provided with a [query]]; }{[KGbdV3rHS3aiVertaRM-gA][geonames_prod][4]: SearchParseException[[geonames_prod][4]: from[-1],size[1]: Parse Failure [Failed to parse source [{\\"size\\":1,\\"sort\\":[\\"_score\\"],\\"fields\\":[\\"geonameid\\",\\"name\\",\\"asciiname\\",\\"alternatenames\\",\\"names\\",\\"countryCode\\",\\"featureClass\\",\\"featureCode\\",\\"cc2\\",\\"admin1Code\\",\\"admin2Code\\",\\"admin3Code\\",\\"admin4Code\\",\\"latitude\\",\\"longitude\\",\\"population\\",\\"DEM\\",\\"timezone\\",\\"modificationDate\\",\\"pin\\"],\\"query\\":{\\"bool\\":{\\"must\\":[{\\"terms\\":{\\"featureCode\\":[\\"ppl\\",\\"ppla\\",\\"ppla2\\",\\"ppla3\\",\\"ppla4\\",\\"pplc\\",\\"pplf\\",\\"pplg\\",\\"ppll\\",\\"pplq\\",\\"pplr\\",\\"ppls\\",\\"pplw\\",\\"pplx\\",\\"stlmt\\"],\\"minimum_match\\":1}},{\\"terms\\":{\\"countryCode\\":[\\"us\\"],\\"minimum_match\\":1}}],\\"boost\\":1,\\"should\\":[{\\"custom_filters_score\\":{\\"query\\":{\\"query_string\\":{\\"fields\\":[\\"name^3\\",\\"alternatenames\\"]}},\\"filters\\":[{\\"filter\\":{\\"numeric_range\\":{\\"population\\":{\\"from\\":\\"1000\\"}}},\\"boost\\":2},{\\"filter\\":{\\"numeric_range\\":{\\"population\\":{\\"from\\":\\"10000\\"}}},\\"boost\\":5},{\\"filter\\":{\\"numeric_range\\":{\\"population\\":{\\"from\\":\\"100000\\"}}},\\"boost\\":3},{\\"filter\\":{\\"geo_distance\\":{\\"distance\\":\\"10km\\",\\"pin.location\\":{\\"lat\\":38,\\"lon\\":-97}}},\\"boost\\":15},{\\"filter\\":{\\"geo_distance\\":{\\"distance\\":\\"200km\\",\\"pin.location\\":{\\"lat\\":38,\\"lon\\":-97}}},\\"boost\\":12},{\\"filter\\":{\\"geo_distance\\":{\\"distance\\":\\"1000km\\",\\"pin.location\\":{\\"lat\\":38,\\"lon\\":-97}}},\\"boost\\":5},{\\"filter\\":{\\"query\\":{\\"query_string\\":{\\"default_field\\":\\"name.untouched\\"}}},\\"boost\\":2},{\\"filter\\":{\\"query\\":{\\"query_string\\":{\\"default_field\\":\\"name\\"}}},\\"boost\\":5}],\\"score_mode\\":\\"multiply\\"}},{\\"prefix\\":{}},{\\"prefix\\":{}}],\\"minimum_number_should_match\\":1}},\\"highlight\\":{\\"fields\\":{\\"name\\":{}}},\\"track_scores\\":true}]]]; nested: QueryParsingException[[geonames_prod] query_string must be provided with a [query]]; }{[KGbdV3rHS3aiVertaRM-gA][geonames_prod][0]: SearchParseException[[geonames_prod][0]: from[-1],size[1]: Parse Failure [Failed to parse source [{\\"size\\":1,\\"sort\\":[\\"_score\\"],\\"fields\\":[\\"geonameid\\",\\"name\\",\\"asciiname\\",\\"alternatenames\\",\\"names\\",\\"countryCode\\",\\"featureClass\\",\\"featureCode\\",\\"cc2\\",\\"admin1Code\\",\\"admin2Code\\",\\"admin3Code\\",\\"admin4Code\\",\\"latitude\\",\\"longitude\\",\\"population\\",\\"DEM\\",\\"timezone\\",\\"modificationDate\\",\\"pin\\"],\\"query\\":{\\"bool\\":{\\"must\\":[{\\"terms\\":{\\"featureCode\\":[\\"ppl\\",\\"ppla\\",\\"ppla2\\",\\"ppla3\\",\\"ppla4\\",\\"pplc\\",\\"pplf\\",\\"pplg\\",\\"ppll\\",\\"pplq\\",\\"pplr\\",\\"ppls\\",\\"pplw\\",\\"pplx\\",\\"stlmt\\"],\\"minimum_match\\":1}},{\\"terms\\":{\\"countryCode\\":[\\"us\\"],\\"minimum_match\\":1}}],\\"boost\\":1,\\"should\\":[{\\"custom_filters_score\\":{\\"query\\":{\\"query_string\\":{\\"fields\\":[\\"name^3\\",\\"alternatenames\\"]}},\\"filters\\":[{\\"filter\\":{\\"numeric_range\\":{\\"population\\":{\\"from\\":\\"1000\\"}}},\\"boost\\":2},{\\"filter\\":{\\"numeric_range\\":{\\"population\\":{\\"from\\":\\"10000\\"}}},\\"boost\\":5},{\\"filter\\":{\\"numeric_range\\":{\\"population\\":{\\"from\\":\\"100000\\"}}},\\"boost\\":3},{\\"filter\\":{\\"geo_distance\\":{\\"distance\\":\\"10km\\",\\"pin.location\\":{\\"lat\\":38,\\"lon\\":-97}}},\\"boost\\":15},{\\"filter\\":{\\"geo_distance\\":{\\"distance\\":\\"200km\\",\\"pin.location\\":{\\"lat\\":38,\\"lon\\":-97}}},\\"boost\\":12},{\\"filter\\":{\\"geo_distance\\":{\\"distance\\":\\"1000km\\",\\"pin.location\\":{\\"lat\\":38,\\"lon\\":-97}}},\\"boost\\":5},{\\"filter\\":{\\"query\\":{\\"query_string\\":{\\"default_field\\":\\"name.untouched\\"}}},\\"boost\\":2},{\\"filter\\":{\\"query\\":{\\"query_string\\":{\\"default_field\\":\\"name\\"}}},\\"boost\\":5}],\\"score_mode\\":\\"multiply\\"}},{\\"prefix\\":{}},{\\"prefix\\":{}}],\\"minimum_number_should_match\\":1}},\\"highlight\\":{\\"fields\\":{\\"name\\":{}}},\\"track_scores\\":true}]]]; nested: QueryParsingException[[geonames_prod] query_string must be provided with a [query]]; }]","status":500}' }
Host nor user/password function is not implemented in the script import.sh
mongoimport -d geonames -c countries --type tsv \
--fields geonameid,name,asciiname,alternatenames,...
on requesting / i get this error:
Refused to execute script from 'https://raw.github.com/evilstreak/markdown-js/master/lib/markdown.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled. localhost/:1
Uncaught ReferenceError: markdown is not defined
travis build fails, see https://travis-ci.org/alchemy-fr/GeonamesServer/builds
Hi,
I have this message while running import.sh :
PHP Warning: require_once(/home/sites_web/GeonamesServer/import/vendor/autoload.php): failed to open stream: Aucun fichier ou dossier de ce type in /home/sites_web/GeonamesServer/import/index.php on line 5
PHP Fatal error: require_once(): Failed opening required '/home/sites_web/GeonamesServer/import/vendor/autoload.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/sites_web/GeonamesServer/import/index.php on line 5
Is there something missing on the documentation or a real problem in the script ?
Regards
Since install & test command are running using Makefile we can not precise mongo or elastic connection credentials.
We should create a configuration file for those credentials and parse it in install.sh and test.sh script
Hi,
When I run "/city?sort=closeness" the server returns "The provided IP is not valid" if I access it directly or through proxy.
Regards
Actually this application work with elasticsearch version 0.20
They do not show the latest modifications in location
property
Hi,
I cannot finish the import process because the last script (import/index.php) does not connect to the mongodb server which is not local :
Couldn't connect to mongodb, is the "mongo" process running?
Regards
If zlib.h
is not present, geoip is not installed, but install script continues
If mongo or elastic search are not present, the data is downloaded (long process) and it fails after that.
If all conditions could be verified before that, that would be awesome
It looks like this repository may have been abandoned. Because some of the requirements for tools etc are quite old I've created a docker build for this. The built contains all of the data in it, so all you need to do is simply run the container and its ready to go!
You can find the container on DockerHub here, https://hub.docker.com/r/jumplead/geonames-server/
I try and rebuild the container once a month to get the latest data 👍
When sorting by closeness, sort should be done against the client IP address if no sortParam is provided.
This is actually not the case, here are the result for paris
, from paris, with and without sort params :
without :
parameters are :
array(
'sort' => 'closeness',
'name' => $place,
'limit' => 1,
);
result is :
HTTP/1.1 200 OK
Server: nginx
Date: Mon, 17 Jun 2013 22:34:32 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 523
Connection: keep-alive
X-Powered-By: Express
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: X-Requested-With, origin, content-type, accept
Access-Control-Allow-Methods: OPTIONS, GET, POST
X-Geonames-sortby: population
{
"geonames": {
"totalResultsCount": "1",
"geoname": [
{
"geonameid": "6837753",
"title": "Paris",
"country": "Indonesia",
"match": {
"title": "Paris",
"country": "Indonesia"
},
"population": "0",
"location": {
"latitude": "-7.52",
"longitude": "112.56"
},
"names": [
"paris",
"paris"
],
"region": "East Java",
"title_alt": "paris"
}
]
}
}
with :
parameters are :
array(
'sort' => 'closeness',
'name' => $place,
'limit' => 1,
'sortParams'=>array(
'ip' => '5.49.69.114'
)
)
result is
HTTP/1.1 200 OK
Server: nginx
Date: Mon, 17 Jun 2013 22:36:21 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 503
Connection: keep-alive
X-Powered-By: Express
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: X-Requested-With, origin, content-type, accept
Access-Control-Allow-Methods: OPTIONS, GET, POST
X-Geonames-sortby: closeness
{
"geonames": {
"totalResultsCount": "1",
"geoname": [
{
"geonameid": "2988496",
"title": "Parisot",
"country": "France",
"match": {
"title": "Parisot",
"country": "France"
},
"population": "0",
"location": {
"latitude": "44.83",
"longitude": "0.9"
},
"names": [
"parisot"
],
"region": "Aquitaine",
"title_alt": "parisot"
}
]
}
}
You can note that the accuracy is not good
Given a city is indexed in "ile-de-france" region
Looking for ile-de-france returns 0 result
It would be nice if we could also return the Administration Area for city results too. These can be looked up by joining the various admin codes together and querying the data in admin2Codes and admin1CodesASCII.
It appears that admin1Codes is already in the database, but admin2Codes isn't. Its only a small amount of data so shouldn't really impact performance in any way.
I would have a go myself but unfortunately I know nothing about nodejs, I'm a PHP developer.
Adam
Actually only ipv4 is supported for geoIP. We could detect if provided IP is a v4 or a v6 one as there are both v4 and V6 geoip database available see http://dev.maxmind.com/geoip/geolite
ElasticSearch after v0.90.4 replaced "custom_filters_score" query with "function_score", subsequently making all the queries to the server to fail.
Latest output from node server after doing GET to /city:
nested: QueryParsingException[[geonames] No query registered for [custom_filters_score]]; }]","status":400}' }
Im not sure if something is wrong with my configuration but when I make a call to my server using JSONP the callback always get set as lower case.
Eg. http://ins-sentry-geoname-eu1a-1.jumplead.com:3000/city?name=paris&limit=8&callback=myFunction
(notice the uppercase F on myFunction);
Gets returned as this:
myfunction(content)
Which means that it breaks jQuery's native jsonp ajax implementation unless you pass a lower case callback function.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.