tomayac / local-reverse-geocoder

Local reverse geocoder for Node.js based on GeoNames data
Apache License 2.0
190 stars 58 forks source link

[Added] Loading of individual country instead of data from all countries #41

Closed helloitsm3 closed 3 years ago

helloitsm3 commented 3 years ago

Tried to implement loading of single country instead of getting data from all countries and cities. Helps to reduce the time taken when initializing the app

helloitsm3 commented 3 years ago

Thanks for the proposal. At the moment it looks like this is hardcoding the country to SG, though. If this becomes a feature, it should be configurable at initialization time.

I was using "SG" to test out to see if it was able to grab only SG.txt. Users will need to specify the country they plan to grab and it'll dump the data into geonames_dump folder

tomayac commented 3 years ago

Yes, but your PR right now hardcodes this.

helloitsm3 commented 3 years ago

Yes, but your PR right now hardcodes this.

Sorry, my bad. I'll remove it and make another pull request

tomayac commented 3 years ago

The way this works should be:

const geocoder = require('local-reverse-geocoder');
geocoder.init(
  {
    load: {
      admin1: true,
      admin2: false,
      admin3And4: false,
      alternateNames: false,
    },
    countries: ['SG'], // <== New, defaults to all countries
  },
  function () {
    // Ready to call lookUp
  }
);
helloitsm3 commented 3 years ago

The way this works should be:


const geocoder = require('local-reverse-geocoder');

geocoder.init(

  {

    load: {

      admin1: true,

      admin2: false,

      admin3And4: false,

      alternateNames: false,

    },

    countries: ['SG'], // <== New, defaults to all countries

  },

  function () {

    // Ready to call lookUp

  }

);

Okay thanks. I'll make the necessary changes later

helloitsm3 commented 3 years ago

Could you add documentation in the README how people would use this, please?

Yes. I'll work on that and push it later

tomayac commented 3 years ago

Fixes https://github.com/tomayac/local-reverse-geocoder/issues/23.

The release just went out as v0.11.0. Thanks again! You're also credited in the README :-)