The implementation follows for most part the PHP code but introduces an additional layer parameter with which the kind of places to be returned can be restricted. This replaces the hard-coded exclusion lists.
This adds an additional layer parameter and slightly changes the queries to do more efficient lookups for large area features.