group duplicate code in function
rename vtMap to map and vtLegend to legend