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):
For each of the country, query an OpenStreetMap database to get matching polygon. Example of an Overpass Query:
(
way["boundary"="administrative"]["ISO3166-1"="CH"];
relation["boundary"="administrative"]["ISO3166-1"="CH"];
);
out geom;
For each of the counties, query an OpenStreetMap database to get matching polygon. Example of an Overpass Query:
(
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.
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.
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):
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.