Simplify the building of the OSM query by reducing the number of temp st...

...rings.
@aashish24 I have pushed a new version that correct the names.