设为首页收藏本站

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 425|回复: 1

adding multiple points to a map using v3 of the Javascript API

[复制链接]
发表于 2014-3-2 16:19:21 | 显示全部楼层 |阅读模式
  1. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
  2. <script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>
  3. <script type="text/javascript">
  4.     $(document).ready(function() { initialize(); });

  5.     function initialize() {
  6.         var map_options = {
  7.             center: new google.maps.LatLng(33.84659,-84.35686),
  8.             zoom: 14,
  9.             mapTypeId: google.maps.MapTypeId.ROADMAP
  10.         };

  11.         var google_map = new google.maps.Map(document.getElementById("map_canvas"), map_options);

  12.         var info_window = new google.maps.InfoWindow({
  13.             content: 'loading'
  14.         });

  15.         var t = [];
  16.         var x = [];
  17.         var y = [];
  18.         var h = [];

  19.         t.push('Location Name 1');
  20.         x.push(33.84659);
  21.         y.push(-84.35686);
  22.         h.push('<p><strong>Location Name 1</strong><br/>Address 1</p>');

  23.         t.push('Location Name 2');
  24.         x.push(33.846253);
  25.         y.push(-84.362125);
  26.         h.push('<p><strong>Location Name 2</strong><br/>Address 2</p>');

  27.         var i = 0;
  28.         for ( item in t ) {
  29.             var m = new google.maps.Marker({
  30.                 map:       google_map,
  31.                 animation: google.maps.Animation.DROP,
  32.                 title:     t[i],
  33.                 position:  new google.maps.LatLng(x[i],y[i]),
  34.                 html:      h[i]
  35.             });

  36.             google.maps.event.addListener(m, 'click', function() {
  37.                 info_window.setContent(this.html);
  38.                 info_window.open(<code><span class="pln">google_map</span></code>, this);
  39.             });
  40.             i++;
  41.         }
  42.     }
  43. </script>
  44. <div id="map_canvas" style="width:400px;height:400px;">Google Map</div>
复制代码
You may also consider Geographic Information Systems


 楼主| 发表于 2014-3-2 16:45:07 | 显示全部楼层
Batchgeo.com is great!  Here's a couple of things I learned: 1) Before uploading to www.batchgeo.com, you can add or remove any columns you want.  And, (2) you have to have the first column named "Title" in your spreadsheet before you upload it to www.batchgeo.com.  Any column heading other than "Title" will return the question mark for the title of the marker.  (I had tried "Customer".  Got a "?")  Obviously, what you put in the "Title" column is what will return as the title on the marker.  (I only figured this out AFTER I entered 141 customer names into the title area of the markers.)

1.        Go to www.batchgeo.com.
2.        Copy the Contact List from the Excel spreadsheet and paste into the area indicated on the batchgeo.com screen.
3.        Click “Map Now” button.
4.        Click “Run Geocoder” button.
5.        Save the results as a KML file to your hard drive by clicking “Google Earth KML” button.
6.        Go to www.maps.google.com
7.        Sign into your account.
8.        Click “My Maps” then “Create new map”
9.        Name the map and (CAREFUL) choose “Public” (all info goes on the web) or “Unlisted” (info is only shared with those you send the link to.)
10.        Now click “Import” and locate the file on the drive.  Click “Open” then “Upload File”.
11.        Make changes to the title, icons, etc as needed.
12.        Click “Save” periodically.  (Learned from experience.)
13.        Click “Done” when done and sign out of the account.
14.        Now you can use the “Send” link at the upper right corner of the map to send the link to others.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|BC Morning Website ( Best Deal Inc. 001 )  

GMT-8, 2025-8-26 02:21 , Processed in 0.014096 second(s), 18 queries .

Supported by Best Deal Online X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表