nager / Nager.Date

Worldwide holidays (REST API), NuGet or docker container :earth_americas:
https://date.nager.at
MIT License
1.07k stars 174 forks source link

Ability to query holidays on coordinates #505

Closed Codain closed 1 year ago

Codain commented 1 year ago

More information

Hello,

I think that being able to query the API with a geographical coordinate would be a cool feature for integration into 3rd party apps.

First it would probably require to build a tree of polygons (can be done once for everyone and refreshed on a periodic basis):

(
  way["boundary"="administrative"]["ISO3166-1"="CH"];
  relation["boundary"="administrative"]["ISO3166-1"="CH"];
);
out geom;
(
  way["boundary"="administrative"]["ISO3166-2"="CH-AG"];
  relation["boundary"="administrative"]["ISO3166-2"="CH-AG"];
);
out geom;

Alternatively, those queries can be adapted to get all countries in one query, all counties in one query, all counties of one country in one query... It would then require some extra post-processing but nothing non-manageable.

Then a function would accept a coordinate to determine which country is containing this position, and then which county of this country. If no county found, consider the country.

Then the existing functions can enter into action to determine the holidays.

tinohager commented 1 year ago

Hi Codain

This is a nice idea but I don't see it in this project. The logic could be integrated into a separate project and then pick up the holidays from this api.