Google maps 如何制作网站中列出的动态地图?

Google maps 如何制作网站中列出的动态地图?,google-maps,dynamic,Google Maps,Dynamic,在我的应用程序中,我有一个商店搜索表单 当用户搜索附近的商店时, 它通过地图链接生成位置列表 当用户单击地图链接时,它应该为该特定位置生成代码 谁能建议我怎么做 我正试着做这样的抚慰 public ActionResult GoogleMap(string address) { StringBuilder map = new StringBuilder(); map.Append("<h1>"); map.Append(add

在我的应用程序中,我有一个商店搜索表单

当用户搜索附近的商店时, 它通过地图链接生成位置列表

当用户单击地图链接时,它应该为该特定位置生成代码

谁能建议我怎么做

我正试着做这样的抚慰

 public ActionResult GoogleMap(string address)
    {
        StringBuilder map = new StringBuilder();
        map.Append("<h1>");
        map.Append(address);
        map.Append("</h1>");
        ViewBag.Address = map;
        return PartialView("_GoogleMap");
    }
更多详情:
我还没有任何从谷歌API检索地图的工作代码。我想做的是,我可以将位置的字符串地址传递到我的action方法中,我想构建可以显示地图块的标记

工作代码链接 这里有一些工作,我希望这将提供更多的细节,我正在努力实现

如果我能用所有的标记来构建我的字符串生成器,那么这一切都可以完成


谢谢,这是我自己做的

我的ScriptGoogleMap.js是这样的

 public ActionResult GoogleMap(string address)
    {
        StringBuilder map = new StringBuilder();
        map.Append("<h1>");
        map.Append(address);
        map.Append("</h1>");
        ViewBag.Address = map;
        return PartialView("_GoogleMap");
    }
我的看法是这样的 将其与API密钥一起包含

<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=true_or_false&amp;key=ABQIAAAAOdhD1B3BVBtgDtcx-d52URS1RRrijDm1gy4LClE7B_C-myLe1RRtDZ0LHqXIq8q0z4mVVysLOLUxtA"></script>


@Html.Raw("<h1>"+PharmacyLocation+"</h1>")
@Html.Hidden("Adrs1", PharmacyLocation, new { id = "ad1" })
@Html.Hidden("Adrs2", DistanceFrom, new { id = "ad2" })
@Html.Hidden("lat", lt, new { id = "lat" })
@Html.Hidden("lng", lg, new { id = "lng" })

<style type="text/css">
  body {
    font-family: Verdana, Arial, sans serif;
    font-size: 11px;
    margin: 2px;
  }
  table.directions th {
background-color:#EEEEEE;
  }

  img {
    color: #000000;
  }
  .directions
  {
  }
  .directions td
  {
      width:300px;
  }
 #directions
 {
  width: 300px; height: auto;
  float: left;

 }
 #map_canvas{ 
  width: 300px; height: 400px;
  float:right;
  margin-top: 16px;
 }
</style>
<script src="../../Scripts/GoogleMap.js" type="text/javascript"></script>
<script>
  $(document).ready(function () {
     initialize()
 });

 </script>
<table class="directions">
<tr><th>Directions</th><th>Map</th></tr>

<tr>
<td valign="top"><div id="directions"></div></td>
<td valign="top"><div id="map_canvas"></div></td>

</tr>
</table>
<script>
    $("#map_canvas").attr("style", "position: absolute; background-color: rgb(229, 227, 223); padding-top:25px;");
</script>

希望这对任何有需要的人都有用。

请提供一个工作代码示例,即在jsfiddle中,我还没有任何从谷歌API检索地图的工作代码。我想做的是,我可以将位置的字符串地址传递到我的操作方法中,我想构建可以显示地图块的标记。@ArgiropoulosStavros嗯,在这里我发现了一些有用的东西,但我无法运行它。你能测试一下吗。您是否需要使用javascript v2 api,还是不介意使用v3?