Refactor template and divide map-style serialization function to
MapStyleEventTemplate.