通过标记在Google Map上设置边界

时间:2018-06-28 00:50:22

标签: google-maps

我知道这可能是以前发布的,但是我尝试过的所有示例都无法正常工作。

我在Google地图上有一个标记列表,我想通过标记集来设置地图的范围。结果是它仅放大了一个标记。

http://dev.rootsofempathy.org/where-we-are/

这是我的代码:

function setMarkers(map){

var content, bounds, loc;

for (var i = 0; i < json.length; i++) {



  /* Set bounds */
  bounds = new google.maps.LatLngBounds();

  var marker = new google.maps.Marker({
    position: { lat: roeMarker[1], lng: roeMarker[2] },
    map: map,

  });
  /* Set marker to bounds */

  loc = new google.maps.LatLng(marker.position.lat(), marker.position.lng());
  bounds.extend(loc);
  marker.setMap(map);

}


/* Add all bounds to map and rezoom and center */

map.fitBounds(bounds); //auto-zoom
map.panToBounds(bounds); //auto-center

1 个答案:

答案 0 :(得分:1)

您在发布的代码中有几次错字:

  1. bounds变量应在循环外部初始化。这:
  2. roeMarker未定义,应为json[i]
function setMarkers(map) {
  var content, bounds, loc;
  for (var i = 0; i < json.length; i++) {
    /* Set bounds */
    bounds = new google.maps.LatLngBounds();  // <====================== move outside the loop

    var marker = new google.maps.Marker({
      position: { lat: roeMarker[1], lng: roeMarker[2] },
      map: map,
    });
    /* Set marker to bounds */
    loc = new google.maps.LatLng(marker.position.lat(), marker.position.lng());
    bounds.extend(loc);
    marker.setMap(map);
  }
  /* Add all bounds to map and rezoom and center */
  map.fitBounds(bounds); //auto-zoom
  map.panToBounds(bounds); //auto-center
}

应为:

function setMarkers(map) {
  var content, loc;
  var bounds = new google.maps.LatLngBounds();
  console.log(json);
  for (var i = 0; i < json.length; i++) {
    var marker = new google.maps.Marker({
      position: {
        lat: json[i][1],
        lng: json[i][2]
      },
      map: map,
    });
    /* Set marker to bounds */
    bounds.extend(marker.getPosition());
  }
  map.fitBounds(bounds); //auto-zoom
}

proof of concept fiddle

screenshot of resulting map

function initialize() {
  var map = new google.maps.Map(
    document.getElementById("map_canvas"), {
      center: new google.maps.LatLng(37.4419, -122.1419),
      zoom: 13,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    });
  setMarkers(map);
}
google.maps.event.addDomListener(window, "load", initialize);

function setMarkers(map) {
  var content, loc;
  var bounds = new google.maps.LatLngBounds();
  for (var i = 0; i < json.length; i++) {
    var marker = new google.maps.Marker({
      position: {
        lat: json[i][1],
        lng: json[i][2]
      },
      map: map,
    });
    /* Set marker to bounds */
    bounds.extend(marker.getPosition());
  }
  map.fitBounds(bounds); //auto-zoom
}
var json = JSON.parse("[[\"Costa Rica\",9.934739,-84.087502,\"http:\\\/\\\/www.rootsofempathy.org\\\/wp-content\\\/uploads\\\/2017\\\/05\\\/Costa-Rica-Instructor-training.jpeg\",\"<ul>\\r\\n \\t<li>Roots of Empathy launched in Costa Rica in May 2017<\\\/li>\\r\\n \\t<li>Five schools in Curridabat will host 10 programs<\\\/li>\\r\\n \\t<li>Ten Instructors have been trained to deliver the programs<\\\/li>\\r\\n \\t<li>We will reach approximately 200 children in our first year<\\\/li>\\r\\n<\\\/ul>\\r\\n<a href=\\\"http:\\\/\\\/rootsofempathy.org\\\/costa-rica\\\/\\\">More info<\\\/a>\"],[\"Hawaii\",19.8967662,-155.5827818,\"http:\\\/\\\/www.rootsofempathy.org\\\/wp-content\\\/uploads\\\/2016\\\/09\\\/aloha.jpg\",\"<ul>\\r\\n \\t<li>Roots of Empathy launched in Hawaii in the fall of 2016<\\\/li>\\r\\n \\t<li>We are delivering 10 programs in 8 schools - 7 schools on Oahu and 1 school on Kauai<\\\/li>\\r\\n \\t<li>We will reach approximately 250 children in our first year\\u00a0\\u00a0\\u00a0\\u00a0\\u00a0\\u00a0 <a href=\\\"http:\\\/\\\/rootsofempathy.org\\\/hawaii\\\/\\\">More info<\\\/a><\\\/li>\\r\\n<\\\/ul>\"],[\"Republic of Ireland\",53.3244427,-6.3861317,\"http:\\\/\\\/www.rootsofempathy.org\\\/wp-content\\\/uploads\\\/2016\\\/02\\\/MGandTaoiseachEndaKenny_23Mar12_lores_short.jpg\",\"<ul>\\r\\n \\t<li>Roots of Empathy has been in the Republic of Ireland since 2011-2012<\\\/li>\\r\\n<\\\/ul>\\r\\n<ul>\\r\\n \\t<li>We have 84 programs running<\\\/li>\\r\\n<\\\/ul>\\r\\n<ul>\\r\\n \\t<li>We're reaching 1,900 children<\\\/li>\\r\\n<\\\/ul>\\r\\n<ul>\\r\\n \\t<li>Since we started, we've reached almost 10,000 children<\\\/li>\\r\\n<\\\/ul>\\r\\n<p style=\\\"text-align: right\\\"><a href=\\\"http:\\\/\\\/dev.rootsofempathy.org\\\/republic-of-ireland\\\/\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">More info<\\\/a><\\\/p>\"],[\"Switzerland\",47.3775498,8.4665031,\"http:\\\/\\\/www.rootsofempathy.org\\\/wp-content\\\/uploads\\\/2016\\\/02\\\/switzerland-photo.jpg\",\"<ul>\\r\\n \\t<li>Roots of Empathy piloted its first program in the Canton of Zurich in 2014-2015<\\\/li>\\r\\n \\t<li>We have delivered 41 programs\\u00a0in 19 schools<\\\/li>\\r\\n \\t<li>We have reached almost 850\\u00a0primary school students<\\\/li>\\r\\n<\\\/ul>\\r\\n<p style=\\\"text-align: right\\\"><a href=\\\"http:\\\/\\\/rootsofempathy.org\\\/switzerland\\\/\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">More info<\\\/a><\\\/p>\"],[\"New Zealand\",-41.2440266,174.621426,\"http:\\\/\\\/www.rootsofempathy.org\\\/wp-content\\\/uploads\\\/2016\\\/02\\\/Room-11-with-Sofia-1.jpg\",\"<p style=\\\"text-align: left\\\">What can Roots of Empathy teach the world?<\\\/p>\\r\\n<p style=\\\"text-align: left\\\">\\u201cThat you can make the place bigger and better when you care about people. You can also make a baby happy or someone happy when you bond for a long time.\\u201d\\r\\n- Year 6 student, Wellington<\\\/p>\\r\\n<p style=\\\"text-align: left\\\"><\\\/p>\\r\\n<p style=\\\"text-align: left\\\"><\\\/p>\\r\\n<p style=\\\"text-align: right\\\"><a href=\\\"http:\\\/\\\/rootsofempathy.org\\\/new-zealand\\\/\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">More info<\\\/a><\\\/p>\"],[\"Wales\",51.5023267,-3.2696213,\"http:\\\/\\\/www.rootsofempathy.org\\\/wp-content\\\/uploads\\\/2016\\\/02\\\/Cardiff_Instructors_Training_Sep12.jpg\",\"<ul>\\r\\n \\t<li>Roots of Empathy launched in Wales in 2012-2013<\\\/li>\\r\\n<\\\/ul>\\r\\n<ul>\\r\\n \\t<li>Since then we've reached more than 2,500 children in Cardiff<\\\/li>\\r\\n<\\\/ul>\\r\\n<ul>\\r\\n \\t<li>This year we have 17 programs in 11 schools<\\\/li>\\r\\n<\\\/ul>\\r\\n<ul>\\r\\n \\t<li>And we're reaching 365 students<\\\/li>\\r\\n<\\\/ul>\\r\\n<p style=\\\"text-align: right\\\"><a href=\\\"http:\\\/\\\/rootsofempathy.org\\\/wales\\\/\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">More Info<\\\/a><\\\/p>\"],[\"Scotland\",55.855573,-4.3728858,\"http:\\\/\\\/www.rootsofempathy.org\\\/wp-content\\\/uploads\\\/2016\\\/02\\\/Around_the_green_blanket_cropped.jpg\",\"<ul>\\r\\n \\t<li>Scotland is the first country worldwide to deliver Roots of Empathy in every council area, following \\u00a31.2 million Scottish Government funding<\\\/li>\\r\\n<\\\/ul>\\r\\n<ul>\\r\\n \\t<li>Scotland was the first European region to introduce Seeds of Empathy<\\\/li>\\r\\n<\\\/ul>\\r\\n<ul>\\r\\n \\t<li>This year we ran\\u00a0175 programs for almost 4,400 students<\\\/li>\\r\\n<\\\/ul>\\r\\n<ul>\\r\\n \\t<li>We have reached almost 20,000 students in Scotland since we launched in 2010<\\\/li>\\r\\n<\\\/ul>\\r\\n&nbsp;\\r\\n<p style=\\\"text-align: right\\\"><a href=\\\"http:\\\/\\\/rootsofempathy.org\\\/scotland\\\/\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">More info<\\\/a><\\\/p>\"],[\"Northern Ireland\",54.5535344,-6.0598135,\"http:\\\/\\\/www.rootsofempathy.org\\\/wp-content\\\/uploads\\\/2016\\\/02\\\/IMG_1525_edit.jpg\",\"<ul>\\r\\n \\t<li>Roots of Empathy launched in Northern Ireland in 2010-2011<\\\/li>\\r\\n<\\\/ul>\\r\\n<ul>\\r\\n \\t<li>We've reached 11,000 children<\\\/li>\\r\\n<\\\/ul>\\r\\n<ul>\\r\\n \\t<li>This year we have 125 programs in Northern Ireland reaching 3,225 students<\\\/li>\\r\\n<\\\/ul>\\r\\n<p style=\\\"text-align: right\\\"><a href=\\\"http:\\\/\\\/rootsofempathy.org\\\/northern-ireland\\\/\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">More Info<\\\/a><\\\/p>\"],[\"England\",51.5287336,-0.382472,\"http:\\\/\\\/www.rootsofempathy.org\\\/wp-content\\\/uploads\\\/2016\\\/05\\\/A4C-49.jpg\",\"<ul>\\r\\n \\t<li>Roots of Empathy launched in England in 2012-2013<\\\/li>\\r\\n<\\\/ul>\\r\\n<ul>\\r\\n \\t<li>We have reached more than 6000 children in Lewisham and Newcastle<\\\/li>\\r\\n<\\\/ul>\\r\\n<ul>\\r\\n \\t<li>We are pleased to be offering programmes in Nottingham and Doncaster in 2015-2016<\\\/li>\\r\\n<\\\/ul>\\r\\n<ul>\\r\\n \\t<li>More than 2000 children are in our programmes this year<\\\/li>\\r\\n<\\\/ul>\\r\\n<p style=\\\"text-align: right\\\"><a href=\\\"http:\\\/\\\/rootsofempathy.org\\\/england\\\/\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">More Info<\\\/a><\\\/p>\"],[\"Washington, D.C.\",38.8995319,-77.1549965,\"http:\\\/\\\/www.rootsofempathy.org\\\/wp-content\\\/uploads\\\/2016\\\/02\\\/2Q.jpg\",\"<ul>\\r\\n \\t<li>Our program started here in 2013-2014<\\\/li>\\r\\n \\t<li>We've delivered 36 programs in DC schools<\\\/li>\\r\\n \\t<li>We've reached 900 students<\\\/li>\\r\\n<\\\/ul>\\r\\n<p style=\\\"text-align: right\\\"><a href=\\\"http:\\\/\\\/rootsofempathy.org\\\/washington-d-c\\\/\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">More Info<\\\/a><\\\/p>\"],[\"Washington\",47.6149938,-122.4763345,\"http:\\\/\\\/www.rootsofempathy.org\\\/wp-content\\\/uploads\\\/2016\\\/05\\\/baby-sam-seattle.jpg\",\"<ul>\\r\\n \\t<li>Roots of Empathy launched in Washington in 2007-2008<\\\/li>\\r\\n \\t<li>Seattle-area schools were the first to host Roots of Empathy programs in the United States<\\\/li>\\r\\n \\t<li>More than 15,000 children have been through our programs here<\\\/li>\\r\\n<\\\/ul>\\r\\n<p style=\\\"text-align: right\\\"><a href=\\\"http:\\\/\\\/rootsofempathy.org\\\/washington\\\/\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">More Info<\\\/a><\\\/p>\"],[\"New Mexico\",35.0826099,-106.81691,\"http:\\\/\\\/www.rootsofempathy.org\\\/wp-content\\\/uploads\\\/2016\\\/02\\\/newmexicoEDIT.jpg\",\"\\u201cBy the end of the year, many students were much more tolerant and accepting toward each other. They understood the importance of empathy when learning about each other\\u2026The skills of empathy and emotional maturity have taught them to be more accepting of younger children. Many of them volunteered to work with the younger students at the school\\u2026[Roots of Empathy] helps students to use their emotions to support their academics...\\u201d\\r\\n- Grade 1 teacher, Albuquerque\\r\\n<p style=\\\"text-align: right\\\"><a href=\\\"http:\\\/\\\/rootsofempathy.org\\\/new-mexico\\\/\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">More Info<\\\/a><\\\/p>\"],[\"New York\",40.70583,-74.2588845,\"http:\\\/\\\/www.rootsofempathy.org\\\/wp-content\\\/uploads\\\/2016\\\/02\\\/PH0010.jpg\",\"<ul>\\r\\n \\t<li>We launched in New York in 2011-2012<\\\/li>\\r\\n \\t<li>We've run 35 programs<\\\/li>\\r\\n \\t<li>We have reached 900 students<\\\/li>\\r\\n<\\\/ul>\\r\\n<p style=\\\"text-align: right\\\"><a href=\\\"http:\\\/\\\/rootsofempathy.org\\\/new-york\\\/\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">More Info<\\\/a><\\\/p>\"],[\"California\",37.7578149,-122.5078123,\"http:\\\/\\\/www.rootsofempathy.org\\\/wp-content\\\/uploads\\\/2016\\\/02\\\/Californiababy2.jpg\",\"<ul>\\r\\n \\t<li>Roots of Empathy launched in the Oakland Unified School District in 2011 - 2012<\\\/li>\\r\\n \\t<li>We have run more than 100 programs in California<\\\/li>\\r\\n \\t<li>We've reached nearly 2,700 children<\\\/li>\\r\\n<\\\/ul>\\r\\n<p style=\\\"text-align: right\\\"><a href=\\\"http:\\\/\\\/rootsofempathy.org\\\/california\\\/\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">More Info<\\\/a><\\\/p>\"],[\"Saskatchewan\",52.1397818,-106.7871549,\"http:\\\/\\\/www.rootsofempathy.org\\\/wp-content\\\/uploads\\\/2016\\\/02\\\/kidskan_baby_celebration_photo.jpg\",\"\\u201cChildren who can recognize the emotions of themselves and others makes their interactions more socially acceptable. They can therefore learn better especially if the environment is calm and caring.\\u201d\\u00a0\\u00a0 - Kindergarten teacher, Shaunavon\\r\\n\\r\\n&nbsp;\\r\\n\\r\\n<a href=\\\"\\\/saskatchewan\\\/\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">More info<\\\/a>\\r\\n<div><\\\/div>\"],[\"Qu\\u00e9bec\",45.5597832,-73.9917114,\"http:\\\/\\\/www.rootsofempathy.org\\\/wp-content\\\/uploads\\\/2016\\\/02\\\/roots-12.jpg\",\"<ul>\\r\\n \\t<li>Roots of Empathy launched in Qu\\u00e9bec in 2005-2006<\\\/li>\\r\\n \\t<li>And we've reached almost 3,500 children<\\\/li>\\r\\n \\t<li>We offer our programs in French and English and to indigenous communities<\\\/li>\\r\\n<\\\/ul>\\r\\n<p style=\\\"text-align: right\\\"><a href=\\\"http:\\\/\\\/rootsofempathy.org\\\/quebec\\\/\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">More Info<\\\/a><\\\/p>\\r\\n\\r\\n<div><\\\/div>\"],[\"Prince Edward Island\",46.4197151,-63.8202693,\"http:\\\/\\\/www.rootsofempathy.org\\\/wp-content\\\/uploads\\\/2016\\\/02\\\/IMG_0364_edit.jpg\",\"<ul>\\r\\n \\t<li>In 2000, Prince Edward Island became the first Atlantic province in Canada to offer the Roots of Empathy program<\\\/li>\\r\\n \\t<li>And we've reached 4,400 children<\\\/li>\\r\\n<\\\/ul>\\r\\n&nbsp;\\r\\n<p style=\\\"text-align: right\\\"><a href=\\\"http:\\\/\\\/rootsofempathy.org\\\/prince-edward-island\\\/\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">More info<\\\/a><\\\/p>\\r\\n\\r\\n<div><\\\/div>\"],[\"Nova Scotia\",45.1409106,-61.9958927,\"http:\\\/\\\/www.rootsofempathy.org\\\/wp-content\\\/uploads\\\/2016\\\/02\\\/IMG_9157_edit.jpg\",\"<ul>\\r\\n \\t<li>Roots of Empathy launched in Nova Scotia in 2003-2004<\\\/li>\\r\\n \\t<li>Since then we've run more than 700 programs in both French and English and to indigenous communities<\\\/li>\\r\\n \\t<li>Our\\u00a0tiny teachers have reached over 18,000 children<\\\/li>\\r\\n<\\\/ul>\\r\\n<p style=\\\"text-align: right\\\"><a href=\\\"http:\\\/\\\/rootsofempathy.org\\\/nova-scotia\\\/\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">More Info<\\\/a><\\\/p>\\r\\n&nbsp;\"],[\"Newfoundland and Labrador\",47.4823014,-53.1095538,\"http:\\\/\\\/www.rootsofempathy.org\\\/wp-content\\\/uploads\\\/2016\\\/02\\\/Nose_KK_permission_IMG_9936_023_edit.jpg\",\"&nbsp;\\r\\n<ul>\\r\\n \\t<li>Since 2001, Roots of Empathy programs have reached more than\\u00a020,000\\u00a0children\\u00a0in Newfoundland and Labrador<\\\/li>\\r\\n \\t<li>In 2015-2016, we've had almost 100 Newfoundland and Labrador babies \\\"teaching\\\" in classrooms<\\\/li>\\r\\n \\t<li>And we've reached 2,375 students<\\\/li>\\r\\n \\t<li>We offer programs in English and French as well as to indigenous communities<\\\/li>\\r\\n<\\\/ul>\\r\\n<p style=\\\"text-align: right\\\"><a href=\\\"http:\\\/\\\/rootsofempathy.org\\\/newfoundland-labrador\\\/\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">More Info<\\\/a><\\\/p>\"],[\"New Brunswick\",45.2599569,-66.1794605,\"http:\\\/\\\/www.rootsofempathy.org\\\/wp-content\\\/uploads\\\/2016\\\/02\\\/IMG_9415_edit.jpg\",\"<ul>\\r\\n \\t<li>We launched in New Brunswick in 2002-2003<\\\/li>\\r\\n \\t<li>Since then we've completed almost 1000 programs<\\\/li>\\r\\n \\t<li>We've reached 23,450 children<\\\/li>\\r\\n \\t<li>We've reached them in both French and English, and those in indigenous communities<\\\/li>\\r\\n \\t<li>More than 25 agencies provide in kind support volunteering Instructors and\\\/or funding for training and materials to support Roots of Empathy<\\\/li>\\r\\n<\\\/ul>\\r\\n<p style=\\\"text-align: right\\\"><a href=\\\"http:\\\/\\\/rootsofempathy.org\\\/new-brunswick\\\/\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">More Info<\\\/a><\\\/p>\"],[\"Manitoba\",49.8534844,-97.4324151,\"http:\\\/\\\/www.rootsofempathy.org\\\/wp-content\\\/uploads\\\/2016\\\/10\\\/eye-contact.jpg\",\"\\u201cI have seen MANY positive changes in my students over the school year. My students have shown significant improvements with how they talk about their feelings and working through problems with their peers.\\u201d\\u00a0\\u00a0 - Grade 1\\\/2 teacher, Winnipeg\\r\\n<p style=\\\"text-align: right\\\"><a href=\\\"http:\\\/\\\/rootsofempathy.org\\\/manitoba\\\/\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">More info<\\\/a><\\\/p>\"],[\"British Columbia\",49.2561055,-123.1939538,\"http:\\\/\\\/www.rootsofempathy.org\\\/wp-content\\\/uploads\\\/2016\\\/02\\\/VancouverBaby.jpg\",\"<p style=\\\"text-align: left\\\">\\u201cI believe this program helps the children to become more aware of their own feelings--especially of love. Love that is so critical to healthy growth of infants, families, communities.\\u201d - Kindergarten Roots of Empathy Instructor, Powell River, BC<\\\/p>\\r\\n<p style=\\\"text-align: right\\\"><a href=\\\"http:\\\/\\\/rootsofempathy.org\\\/british-columbia\\\/\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">More info<\\\/a><\\\/p>\"],[\"Alberta\",53.5555501,-113.7741353,\"http:\\\/\\\/www.rootsofempathy.org\\\/wp-content\\\/uploads\\\/2016\\\/02\\\/Welcome_KK_permission_IMG_9173_004_edit.jpg\",\"\\u201cRoots of Empathy could teach the world to love more.\\u201d\\u00a0 - Grade 3 student, St. Albert\\r\\n<p style=\\\"text-align: right\\\"><a href=\\\"http:\\\/\\\/rootsofempathy.org\\\/alberta\\\/\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">More info<\\\/a><\\\/p>\\r\\n\\r\\n<div><\\\/div>\"],[\"Germany\",52.520007,13.404954,\"http:\\\/\\\/www.rootsofempathy.org\\\/wp-content\\\/uploads\\\/2015\\\/12\\\/MHO_2012-01-15_RootsOfEmpathy_Schule_058-8-Kopie.jpg\",\"<ul>\\r\\n \\t<li>Roots of Empathy launched its first-ever German language programs with a pilot in Bremen, Germany, during the 2012-13 academic season<\\\/li>\\r\\n<\\\/ul>\\r\\n<ul>\\r\\n \\t<li>The expansion of programs to Germany marks the introduction of Roots of Empathy to continental Europe<\\\/li>\\r\\n<\\\/ul>\\r\\n<p style=\\\"text-align: right\\\"><a href=\\\"http:\\\/\\\/rootsofempathy.org\\\/germany\\\/\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">More info<\\\/a><\\\/p>\"],[\"Ontario\",43.719768,-79.331575,\"http:\\\/\\\/www.rootsofempathy.org\\\/wp-content\\\/uploads\\\/2015\\\/12\\\/P00006_ROE_Toronto_ON_20110503_HR_PCmgordon_cropped.jpg\",\"<ul>\\r\\n \\t<li>Toronto, Ontario, is the birthplace of Roots of Empathy and its international headquarters<\\\/li>\\r\\n \\t<li>Roots of Empathy's first pilot program was launched in 1996-1997<\\\/li>\\r\\n \\t<li>Since then, we have delivered more than 11,000 Roots of Empathy programs and reached over 278,000 Ontario students<\\\/li>\\r\\n \\t<li>Seeds of Empathy launched in 2008<\\\/li>\\r\\n \\t<li>Since then we've delivered almost 300 Seeds of Empathy programs and reached over 4,000 Ontario preschool children<\\\/li>\\r\\n<\\\/ul>\\r\\n<p style=\\\"text-align: right\\\"><a href=\\\"http:\\\/\\\/rootsofempathy.org\\\/ontario\\\/\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">More info<\\\/a><\\\/p>\\r\\n\\r\\n<div><\\\/div>\"]]");
html,
body,
#map_canvas {
  height: 100%;
  width: 100%;
  margin: 0px;
  padding: 0px
}
<script src="https://maps.googleapis.com/maps/api/js"></script>
<div id="map_canvas"></div>