tomayac / local-reverse-geocoder

Local reverse geocoder for Node.js based on GeoNames data

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Async loading

natanavra opened this issue · comments

The init and lookUp (without init) are blocking calls, even though they have a callback param.

Also, could you clear up the initial loading from remote location, because I didn't notice any requests executed from the library. Is there any option to download a dump of the data beforehand for the service to use?

@natanavra I have just release v0.2.1 that makes the initialization process more transparent. Please also see the Word on Speed where this process is explained. I'm closing the issue, as this is working as intended (hopefully with the logging it is clearer now).

>$ node app.js

Initializing local reverse geocoder using dump directory: local-reverse-geocoder/geonames_dump
Getting GeoNames cities data from http://download.geonames.org/export/dump/cities1000.zip (this may take a while)
Getting GeoNames admin 1 codes data from http://download.geonames.org/export/dump/admin1CodesASCII.txt (this may take a while)
Getting GeoNames admin 2 codes data from http://download.geonames.org/export/dump/admin2Codes.txt (this may take a while)
Getting GeoNames all countries data from http://download.geonames.org/export/dump/allCountries.zip (this may take a while)
Getting GeoNames alternate names data from http://download.geonames.org/export/dump/alternateNames.zip (this may take a while)
Received zipped GeoNames cities data
Unzipped GeoNames cities data
Started parsing cities.txt (this  may take a while)
Finished parsing cities.txt
Started building cities k-d tree (this may take a while)
Finished building cities k-d tree
Received zipped GeoNames alternate names data
Unzipped GeoNames alternate names data
Received zipped GeoNames all countries data
Unzipped GeoNames all countries data
Started parsing all countries.txt (this  may take a while)
Parsing progress all countries 0
[…]
Parsing progress all countries 11000000
Finished parsing all countries.txt
Local reverse geocoder listening on port 3000
Look-up request for point {"latitude":48.466667,"longitude":9.133333}
Look-up request for point {"latitude":58.3839542,"longitude":-134.7383241}
Found result(s) for point {"latitude":48.466667,"longitude":9.133333}
  (1) {"geoNameId":"2919146","name":"Gomaringen"},
  (2) {"geoNameId":"2814195","name":"Wannweil"}
Found result(s) for point {"latitude":58.3839542,"longitude":-134.7383241}
  (1) {"geoNameId":"5554072","name":"Juneau"},
  (2) {"geoNameId":"5846901","name":"Haines"}
Delivering joint results