generic function for data to marker