nchaulet / node-geocoder

nodejs geocoding library
http://nchaulet.github.io/node-geocoder/
MIT License
926 stars 213 forks source link

How to set limit of results in openstreetmap #344

Open flamurbeqiri1 opened 1 year ago

flamurbeqiri1 commented 1 year ago

I use the provider openstreetmap and according to documentation it says we can use the nominatim properties. How can we e.x use the limit for geocode.

Currently I have: let results: any = await geocoder.geocode(query);

The initialiser requires only the query string :/

nchaulet commented 1 year ago

Hi I just added an example test on how you can use openstreetmap with custom props https://github.com/nchaulet/node-geocoder/blob/master/integration_test/geocoder/openstreetmapgeocoder.test.js#L30

flamurbeqiri1 commented 1 year ago

How does it work on your case when i get: Argument of type '{ q: string; limit: number; }' is not assignable to parameter of type 'string | Query'. Object literal may only specify known properties, and 'q' does not exist in type 'Query'.ts(2345) And i see there is no "q" in the Query Interface!

nchaulet commented 1 year ago

Oh I guess the types probably need to be updated, the node-geocoder module is not written in typescript and types are coming from DefinitelyTyped/DefinitelyTyped. You can probably temporarly fix this in your code with a ts-expect-error or ts-ignore comment

flamurbeqiri1 commented 1 year ago

Ok, thnx