calculate map size with javascript.