網頁

2014年3月25日 星期二

Google Places API Place Searches

地方資訊程式庫


      var checkinArray = [];
      var checkinJSON = "";
    
     
      document.getElementById("results_a").innerHTML   += '
      '; if (status == google.maps.places.PlacesServiceStatus.OK) { for (var i = 0; i < results.length; i++) { createMarker(results[i]); document.getElementById("results_a").innerHTML += '
    • ' + results[i].name + ' ' + results[i].geometry.location.lat() + ' ' + results[i].geometry.location.lng() + '
    • '; var checkinData = { "name": results[i].name, "lat": results[i].geometry.location.lat(), "lng": results[i].geometry.location.lng(), }; checkinArray.push(checkinData); } } document.getElementById("results_a").innerHTML += '
    '; checkinJSON = JSON.stringify({checkin: checkinArray}); document.getElementById("results_json").innerHTML = checkinJSON;



    Javascript Array to JSON String with JSON.stringify


    {
      "checkinArray": [
        {
          "name": "John St Square Supermarket",
          "lat": -33.86771,
          "lng": 151.191917
        },
        {
          "name": "Pancakes on the Rocks",
          "lat": -33.87054,
          "lng": 151.19881499999997
        },
        {
          "name": "Hurricane's Grill",
          "lat": -33.870779,
          "lng": 151.19895900000006
        },
        {
          "name": "Adriano Zumbo at the Star",
          "lat": -33.868173,
          "lng": 151.19465200000002
        },
        {
          "name": "Garden Buffet",
          "lat": -33.868263,
          "lng": 151.19440099999997
        },
        {
          "name": "Sydney Electric Bikes",
          "lat": -33.87023,
          "lng": 151.197231
        },
        {
          "name": "Six Star Spa",
          "lat": -33.870451,
          "lng": 151.19222100000002
        },
        {
          "name": "Life Interiors Pty Ltd",
          "lat": -33.870519,
          "lng": 151.195693
        },
        {
          "name": "Gelato Messina - The Star",
          "lat": -33.868391,
          "lng": 151.19450699999993
        },
        {
          "name": "Porters Liquor Pyrmont Pymont Cellars",
          "lat": -33.869552,
          "lng": 151.19347400000004
        },
        {
          "name": "Red Bottle",
          "lat": -33.866518,
          "lng": 151.19219299999997
        },
        {
          "name": "Harrogate Tea Shop & Tea Rooms",
          "lat": -33.869657,
          "lng": 151.19464800000003
        },
        {
          "name": "SUPA IGA Pyrmont",
          "lat": -33.870164,
          "lng": 151.19277699999998
        },
        {
          "name": "Urban Oasis",
          "lat": -33.869578,
          "lng": 151.19373399999995
        },
        {
          "name": "Kwik Kopy Darling Harbour",
          "lat": -33.87067,
          "lng": 151.19665699999996
        },
        {
          "name": "Esprit",
          "lat": -33.870091,
          "lng": 151.196776
        },
        {
          "name": "JW Marine",
          "lat": -33.863508,
          "lng": 151.19481799999994
        },
        {
          "name": "Coles Supermarket",
          "lat": -33.869398,
          "lng": 151.19634900000005
        },
        {
          "name": "Nomadic Rug Traders",
          "lat": -33.869578,
          "lng": 151.19373399999995
        },
        {
          "name": "City Convenience Store",
          "lat": -33.868173,
          "lng": 151.19465200000002
        }
      ]
    }

    沒有留言:

    張貼留言

    注意:只有此網誌的成員可以留言。