Skip to content

Instantly share code, notes, and snippets.

@jurgens
Created March 5, 2014 15:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jurgens/9369303 to your computer and use it in GitHub Desktop.
Save jurgens/9369303 to your computer and use it in GitHub Desktop.
show single point on a google map
class InitMap
constructor: (element, data) ->
latlng = new google.maps.LatLng(data.lat, data.long)
options =
zoom: 12
center: latlng
mapTypeId: google.maps.MapTypeId.ROADMAP
map = new google.maps.Map(element, options)
marker = new google.maps.Marker(
position: latlng
clickable: true
center: latlng
map: map
)
info_window = new google.maps.InfoWindow()
info_html = ""
info_html = "<strong>" + data.title + "&nbsp;&nbsp; " + data.price + "</strong><br>" if data.title.length > 0
info_html += data.address
info_window.setContent info_html
info_window.open map, marker
window.init_map = InitMap;
@maslenkov
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment