Tincho has an updated osm that fixes some basic usages, greatly simplifies the code, and would let us close replace openlayers with leaflet and osm plugin fails to display map with javascript error, at the cost of removing some features.

The branch already incorporates changes from my review and additional fixes. I'd appreciate additional careful review from another maintainer, including about the points raised at discussion.