If you decide to go global, it's easy to get locations (and sometimes other data, like wheelchair access or even opening hours) from OSM:
- tag: https://wiki.openstreetmap.org/wiki/Tag:amenity=toilets
- example query with Overpass API: http://overpass-turbo.eu/?template=key-value&key=amenity&val...
But this approach (all data in a single huge array) could be pretty slow with a lot of restrooms: https://restroomfinder.co/data.js