Google Maps JavaScript API V3, plot array of Lat/Lon Points -


i'm trying create simple google map iterate through multi-dimensional array of lat/lon pairs , plot them. map display if for-loop commented-out. in advance.

here code have:

<script type="text/javascript">     function initialize()     {            var map;     var mapoptions =     {         zoom: 9,         center: new google.maps.latlng(39.03454, -94.587315),         maptypeid: google.maps.maptypeid.roadmap,     };      map = new google.maps.map(document.getelementbyid('body-space-inside'),                     mapoptions);      var business_locations =          [             ['south plaza',     '5105 main st  kansas city, mo 64112', '39.03454', '-94.587315'],             ['city market',     '427 main street kansas city, mo 64105',        39.108518, -94.582635],             ['barry road east', '221 northeast barry road kansas city, mo 64155', 39.246116, -94.57759],             ['barry road west', '7007 nw barry road kansas city, mo 64153',     39.246116, -94.57759],             ['shawnee',         '7198 renner road shawnee, ks 66217',           38.999569, -94.779798],             ['blue springs',    '2201 nw state route 7 blue springs, mo 64014', 39.04395, -94.271227],             ['leawood',         '12920 state line road leawood, ks 66209',      38.893127, -94.607991],             ['lenexa',          '13400 college boulevard lenexa, ks 66210',     38.927529, -94.741263],             ['olathe',          '15983 s bradley drive olathe, ks 66062',       38.838983, -94.778771],             ['prarie village',  '6921 tomahawk rd prairie village, ks 66208',   39.003414, -94.631471],             ['independence',    '2551 s state route 291 independence, mo 64057', 39.073201, -94.378762],             ['lees summit',     '632 ne state route 291 lees summit, mo 64086', 38.923416, -94.360608],             ['liberty',         '205 n 291 highway liberty, mo 64068',          39.246472, -94.443878];         ];      for(var = 0; < business_locations.length; i++)         {             var marker = new google.maps.marker({                 position: new google.maps.latlng(business_locations[i][2], business_locations[i][3]),                 map: map,                 title: 'test',             });         }     };      google.maps.event.adddomlistener(window, 'load', initialize);     </script> 

just change below line

position: new google.maps.latlng(business_locations[i][2], business_locations[i][3])

to

position: new google.maps.latlng(business_locations[i][2], business_locations[i][3])

javascript case sensitive.it work fine.


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo