Looking for APIs to query the database (R or Python preferred).

Hello, I’d like to know what are the API available to query the OSM database.
In particular I am interested in 2 broad types of queries:

-1- geocode queries
INPUT GPS loc – OUTPUT full directions including ZIP
INPUT street name + street number + city – OUTPUT full direction with ZIP code, with or without GPS loc
INPUT 2 cross streets – OUTPUT full direction with ZIP code, with or without GPS loc

-2- queries with GPS loc for POIs
INPUT GPS loc – OUTPUT POIs within a certain area centered around the GPS loc.

This is for academic purposes in the area of ML. I work with R, Python, or C/C++.
Any pointer toward the right place and documentation would be really welcome.
Thank you.

For geocoding :

Check Nominatim:

queries with GPS loc for POIs

Check the Overpass API ( https://wiki.openstreetmap.org/wiki/Overpass_API ; http://overpass-turbo.eu/ )

The Wizard language is very simple: “amenity=hospital in Budapest” → http://overpass-turbo.eu/s/Df9

don’t forget the (License) Attribution! :slight_smile:

To add to what has already been said, with OSM you’ve also got the option of just downloading the data, loading it into a database and doing any sort of query you want on it. You’re not limited to “remote” APIs.