Rewrite superior function to save memory and improve speed

don't collect all results in a list and process list in final part, but rather return results when they are generated and order from the SQL query in Mapnik style sheet. Need additional columns in return structure.