使用markermanager.js从API2迁移到API3

时间:2015-05-28 22:34:03

标签: google-maps google-maps-api-3

我将地图API2更新为API3时遇到问题。

我无法使用markermanager.js库从JSON文件导入/显示标记。

我收到了错误:未捕获的TypeError:无法读取属性' lng'未定义的

我将函数GDownloadUrl从小文件

更改为jx.load
    <script type="text/javascript" src="http://www.openjs.com/scripts/jx/jx.js"></script> 

它工作正常。

来源js代码:

    var mapa;
    var manager;
    var markery = [];

            // wspólne cechy ikon
            var rozmiar = new google.maps.Size(15,15);
            var rozmiar_cien = new google.maps.Size(59,32);
            var punkt_startowy = new google.maps.Point(8,8);
            var punkt_zaczepienia = new google.maps.Point(8,8);

            // ikonki
            var ikona = new google.maps.MarkerImage("/test/marker.png", rozmiar, punkt_startowy, punkt_zaczepienia);
            var cien = new google.maps.MarkerImage("", rozmiar_cien, punkt_startowy, punkt_zaczepienia);

    function mapaStart()
    {
            // tworzymy mapę
            var wspolrzedne = new google.maps.LatLng(37.642647000000004,-122.272251);
            var opcjeMapy = {
                zoom: 9,
                center: wspolrzedne,
                scaleControl: true,
                overviewMapControl: true,
                overviewMapControlOptions:{opened:true},
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            mapa = new google.maps.Map(document.getElementById("mapka"), opcjeMapy); 

            manager = new MarkerManager(mapa); //,{maxZoom: 19});
            pobierzMarkery();
    }

    function pobierzMarkery()
    {
        //GDownloadUrl('/test/markery.php',function(dane,kodOdpowiedzi)
        //Change GDownloadUrl to microAjax
        jx.load('/test/markery.php',function(dane,kodOdpowiedzi)
        {   
            var wyniki = eval('('+dane+')');
            var tablicaMarkerow = [];
            for(var i=0; i<wyniki['markery'].length; i++)
            {
                tablicaMarkerow.push(utworzMarker(wyniki['markery'][i]['id'],wyniki['markery'][i]['lat'], wyniki['markery'][i]['lng'], wyniki['markery'][i]['nazwa']));

            }
            manager.addMarkers(tablicaMarkerow,5,19);   //markers,min zoom, max zoom
            manager.refresh();

        });
    }

    function utworzMarker(id,lat,lng,tekst)
    {   
        var punkt = new google.maps.LatLng(lat,lng);
        var marker = new google.maps.Marker(opcje);
        var opcje = 
        {
            position: punkt,
            map: mapa,
            title: tekst,
            icon: ikona,
            shadow: cien
        }
        marker.tekst = tekst;
        markery[id] = marker;
        google.maps.event.addDomListener(marker,'click',function()
        {
            marker.openInfoWindowHtml(marker.tekst);
        });
        return marker;
    }

我使用谷歌库:

    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> 
    <script type="text/javascript" src="http://google-maps-utility-library-v3.googlecode.com/svn/tags/markermanager/1.0/src/markermanager.js"></script>

HTML

   <div id='mapka' style='width: 400px; height: 500px; border: 1px solid black; background: gray;'></div>

1 个答案:

答案 0 :(得分:1)

您没有正确初始化google.maps.Marker,您需要先创建MarkerOptions对象并将其传递给标记构造函数(或将匿名对象传递给构造函数。所以:

function utworzMarker(id,lat,lng,tekst)
{   
    var punkt = new google.maps.LatLng(lat,lng);
    var marker = new google.maps.Marker(opcje);
    var opcje = 
    {
        position: punkt,
        map: mapa,
        title: tekst,
        icon: ikona,
        shadow: cien
    }
    marker.tekst = tekst;
    markery[id] = marker;
    google.maps.event.addDomListener(marker,'click',function()
    {
        marker.openInfoWindowHtml(marker.tekst);
    });
    return marker;
}

应该是:

function utworzMarker(id,lat,lng,tekst)
{   
    var punkt = new google.maps.LatLng(lat,lng);
    var opcje = 
    {
        position: punkt,
        map: mapa,
        title: tekst,
        icon: ikona,
        shadow: cien
    }
    var marker = new google.maps.Marker(opcje);
    marker.tekst = tekst;
    markery[id] = marker;
    google.maps.event.addDomListener(marker,'click',function()
    {
        marker.openInfoWindowHtml(marker.tekst);
    });
    return marker;
}

working fiddle

但这给了我Uncaught TypeError: marker.openInfoWindowHtml is not a function因为v3中不存在。您需要为v3更新utworzMarker函数(创建一个全局google.maps.InfoWindow对象,并使用它。)

function utworzMarker(id, lat, lng, tekst) {
    var punkt = new google.maps.LatLng(lat, lng);
    var opcje = {
        position: punkt,
        map: mapa,
        title: tekst,
        icon: ikona,
        shadow: cien
    };
    var marker = new google.maps.Marker(opcje);

    marker.tekst = tekst;
    markery[id] = marker;
    google.maps.event.addDomListener(marker, 'click', function () {
        infowindow.setContent(marker.tekst);
        infowindow.open(mapa, marker);
    });
    return marker;
}

working fiddle with InfoWindows

代码段:

var mapa;
var manager;
var markery = [];
var infowindow = new google.maps.InfoWindow();

// wspólne cechy ikon
var rozmiar = new google.maps.Size(15, 15);
var rozmiar_cien = new google.maps.Size(59, 32);
var punkt_startowy = new google.maps.Point(8, 8);
var punkt_zaczepienia = new google.maps.Point(8, 8);

// ikonki
var ikona = new google.maps.MarkerImage("http://maps.google.com/mapfiles/ms/icons/blue.png", rozmiar, punkt_startowy, punkt_zaczepienia);
var cien = new google.maps.MarkerImage("", rozmiar_cien, punkt_startowy, punkt_zaczepienia);

function mapaStart() {
  // tworzymy mapę
  var wspolrzedne = new google.maps.LatLng(37.642647000000004, -122.272251);
  var opcjeMapy = {
    zoom: 9,
    center: wspolrzedne,
    scaleControl: true,
    overviewMapControl: true,
    overviewMapControlOptions: {
      opened: true
    },
    mapTypeId: google.maps.MapTypeId.ROADMAP
  };
  mapa = new google.maps.Map(document.getElementById("mapka"), opcjeMapy);

  manager = new MarkerManager(mapa); //,{maxZoom: 19});
  pobierzMarkery();
}

function pobierzMarkery() {
  //GDownloadUrl('/test/markery.php',function(dane,kodOdpowiedzi)
  //Change GDownloadUrl to microAjax
  //    jx.load('/test/markery.php', function (dane, kodOdpowiedzi) {
  var wyniki = markerJSON; /// eval('(' + markerJSON + ')');
  var tablicaMarkerow = [];
  for (var i = 0; i < wyniki['markery'].length; i++) {
    tablicaMarkerow.push(utworzMarker(wyniki['markery'][i]['id'], wyniki['markery'][i]['lat'], wyniki['markery'][i]['lng'], wyniki['markery'][i]['nazwa']));

  }
  manager.addMarkers(tablicaMarkerow, 5, 19); //markers,min zoom, max zoom
  manager.refresh();

  //    });
}

function utworzMarker(id, lat, lng, tekst) {
  var punkt = new google.maps.LatLng(lat, lng);
  var opcje = {
    position: punkt,
    map: mapa,
    title: tekst,
    icon: ikona,
    shadow: cien
  };
  var marker = new google.maps.Marker(opcje);

  marker.tekst = tekst;
  markery[id] = marker;
  google.maps.event.addDomListener(marker, 'click', function() {
    infowindow.setContent(marker.tekst);
    infowindow.open(mapa, marker);
  });
  return marker;
}
google.maps.event.addDomListener(window, 'load', mapaStart);
var markerJSON = {
  "id_wyszukiwania": 0,
  "markery": [{
    "id": 1,
    "nazwa": "Zażółć Gęślą Jaźń",
    "lat": 37.3863,
    "lng": -122.086
  }, {
    "id": 2,
    "nazwa": "Amici's East Coast Pizzeria",
    "lat": 37.3871,
    "lng": -122.083
  }, {
    "id": 3,
    "nazwa": "Kapp's Pizza Bar & Grill",
    "lat": 37.3939,
    "lng": -122.079
  }, {
    "id": 4,
    "nazwa": "Round Table Pizza: Mountain View",
    "lat": 37.4027,
    "lng": -122.079
  }, {
    "id": 0,
    "nazwa": "Sausage Factory Inc",
    "lat": 37.3896,
    "lng": -122.081
  }, {
    "id": 0,
    "nazwa": "Tony & Alba's Pizza & Pasta",
    "lat": 37.394,
    "lng": -122.096
  }, {
    "id": 0,
    "nazwa": "Oregano's Wood-Fired Pizza",
    "lat": 37.4017,
    "lng": -122.115
  }, {
    "id": 0,
    "nazwa": "Round Table Pizza: Sunnyvale-Mary-Central Expy",
    "lat": 37.39,
    "lng": -122.042
  }, {
    "id": 0,
    "nazwa": "Giordano's",
    "lat": 41.8957,
    "lng": -87.6254
  }, {
    "id": 0,
    "nazwa": "Filippi's Pizza Grotto",
    "lat": 32.7238,
    "lng": -117.168
  }, {
    "id": 0,
    "nazwa": "Pizzeria Paradiso",
    "lat": 38.9096,
    "lng": -77.0459
  }, {
    "id": 0,
    "nazwa": "Tutta Bella Neapolitan Pizzera",
    "lat": 47.5577,
    "lng": -122.285
  }, {
    "id": 0,
    "nazwa": "Touche Pasta Pizza Pool",
    "lat": 45.5265,
    "lng": -122.686
  }, {
    "id": 0,
    "nazwa": "Piecora's New York Pizza",
    "lat": 47.614,
    "lng": -122.314
  }, {
    "id": 0,
    "nazwa": "Pagliacci Pizza",
    "lat": 47.6239,
    "lng": -122.357
  }, {
    "id": 0,
    "nazwa": "Zeeks Pizza - Phinney Ridge",
    "lat": 47.6727,
    "lng": -122.354
  }, {
    "id": 0,
    "nazwa": "Old Town Pizza",
    "lat": 45.5246,
    "lng": -122.673
  }, {
    "id": 0,
    "nazwa": "Zeeks Pizza - Belltown",
    "lat": 47.6183,
    "lng": -122.348
  }, {
    "id": 0,
    "nazwa": "Escape From New York Pizza",
    "lat": 45.5271,
    "lng": -122.699
  }, {
    "id": 0,
    "nazwa": "Big Fred's Pizza Garden",
    "lat": 41.2487,
    "lng": -96.0988
  }, {
    "id": 0,
    "nazwa": "Old Chicago",
    "lat": 41.2565,
    "lng": -95.9307
  }, {
    "id": 0,
    "nazwa": "Sgt Peffer's Cafe Italian",
    "lat": 41.2731,
    "lng": -95.9878
  }, {
    "id": 0,
    "nazwa": "Mama's Pizza",
    "lat": 41.2659,
    "lng": -95.9807
  }, {
    "id": 0,
    "nazwa": "Zio's New York Style Pizzeria",
    "lat": 41.2555,
    "lng": -95.932
  }, {
    "id": 0,
    "nazwa": "Zio's New York Style Pizzeria",
    "lat": 41.2632,
    "lng": -96.0564
  }, {
    "id": 0,
    "nazwa": "La Casa Pizzaria",
    "lat": 41.2524,
    "lng": -95.9796
  }, {
    "id": 0,
    "nazwa": "Lou Malnati's Pizzeria",
    "lat": 41.8903,
    "lng": -87.6339
  }, {
    "id": 0,
    "nazwa": "Piece Restaurant",
    "lat": 41.9105,
    "lng": -87.6761
  }, {
    "id": 0,
    "nazwa": "Connie's Pizza Inc",
    "lat": 41.8492,
    "lng": -87.6417
  }, {
    "id": 0,
    "nazwa": "Exchequer Restaurant",
    "lat": 41.8792,
    "lng": -87.6261
  }, {
    "id": 0,
    "nazwa": "Coco's By The Falls",
    "lat": 43.0836,
    "lng": -79.0827
  }, {
    "id": 0,
    "nazwa": "Pompei",
    "lat": 41.8693,
    "lng": -87.6648
  }, {
    "id": 0,
    "nazwa": "Lynn's Paradise Cafe",
    "lat": 38.2369,
    "lng": -85.7285
  }, {
    "id": 0,
    "nazwa": "Otto Restaurant Enoteca Pizza",
    "lat": 40.7322,
    "lng": -73.9963
  }, {
    "id": 0,
    "nazwa": "Grimaldi's",
    "lat": 40.7025,
    "lng": -73.9937
  }, {
    "id": 0,
    "nazwa": "Lombardi's",
    "lat": 40.7217,
    "lng": -73.9956
  }, {
    "id": 0,
    "nazwa": "John's Pizzeria",
    "lat": 40.7317,
    "lng": -74.0033
  }, {
    "id": 0,
    "nazwa": "John's Pizzeria",
    "lat": 40.7581,
    "lng": -73.9877
  }, {
    "id": 0,
    "nazwa": "Burger Joint",
    "lat": 40.7824,
    "lng": -73.981
  }, {
    "id": 0,
    "nazwa": "Frank Pepe Pizzeria Napoletana",
    "lat": 41.3028,
    "lng": -72.917
  }, {
    "id": 0,
    "nazwa": "Adrianne's Pizza Bar",
    "lat": 40.7045,
    "lng": -74.0101
  }, {
    "id": 0,
    "nazwa": "Pizzeria Regina: Regina Pizza",
    "lat": 42.3653,
    "lng": -71.0568
  }, {
    "id": 0,
    "nazwa": "Upper Crust",
    "lat": 42.3566,
    "lng": -71.0697
  }, {
    "id": 0,
    "nazwa": "Bertucci's Brick Oven Rstrnt",
    "lat": 42.3319,
    "lng": -71.1153
  }, {
    "id": 0,
    "nazwa": "Aquitaine",
    "lat": 42.3436,
    "lng": -71.0723
  }, {
    "id": 0,
    "nazwa": "Bertucci's Brick Oven Rstrnt",
    "lat": 42.3483,
    "lng": -71.0732
  }, {
    "id": 0,
    "nazwa": "Upper Crust",
    "lat": 42.3429,
    "lng": -71.1223
  }, {
    "id": 0,
    "nazwa": "Bertucci's Brick Oven Rstrnt",
    "lat": 42.3633,
    "lng": -71.0972
  }, {
    "id": 0,
    "nazwa": "Bertucci's Brick Oven Rstrnt",
    "lat": 42.3591,
    "lng": -71.0555
  }, {
    "id": 0,
    "nazwa": "Vinnie Van Go-Go's",
    "lat": 32.0812,
    "lng": -81.095
  }, {
    "id": 0,
    "nazwa": "Domino's Pizza: Myrtle Beach",
    "lat": 33.6749,
    "lng": -78.9051
  }, {
    "id": 0,
    "nazwa": "East of Chicago Pizza Company",
    "lat": 33.7161,
    "lng": -78.8556
  }, {
    "id": 0,
    "nazwa": "Villa Tronco Italian Rstrnt",
    "lat": 34.008,
    "lng": -81.0363
  }, {
    "id": 0,
    "nazwa": "Mellow Mushroom Pizza Bakers",
    "lat": 32.0747,
    "lng": -81.0937
  }, {
    "id": 0,
    "nazwa": "Andolinis Pizza",
    "lat": 32.7823,
    "lng": -79.9342
  }, {
    "id": 0,
    "nazwa": "Mellow Mushroom Pizza Bakers",
    "lat": 33.9578,
    "lng": -83.3747
  }, {
    "id": 0,
    "nazwa": "Bucks Pizza of Edisto Beach Inc",
    "lat": 32.504,
    "lng": -80.298
  }, {
    "id": 0,
    "nazwa": "Anthony's Coal Fired Pizza",
    "lat": 26.0947,
    "lng": -80.1367
  }, {
    "id": 0,
    "nazwa": "Giordano's",
    "lat": 28.3894,
    "lng": -81.5062
  }, {
    "id": 0,
    "nazwa": "Pizza Rustica",
    "lat": 25.7791,
    "lng": -80.1331
  }, {
    "id": 0,
    "nazwa": "Mama Jennie's Italian Restaurant",
    "lat": 25.8828,
    "lng": -80.1943
  }, {
    "id": 0,
    "nazwa": "Anthony's Coal Fired Pizza",
    "lat": 25.9411,
    "lng": -80.1488
  }, {
    "id": 0,
    "nazwa": "Anthony's Coal Fired Pizza",
    "lat": 26.0654,
    "lng": -80.3624
  }, {
    "id": 0,
    "nazwa": "Mario the Baker Pizza & Italian Restaurant",
    "lat": 25.9297,
    "lng": -80.1561
  }, {
    "id": 0,
    "nazwa": "Big Cheese Pizza",
    "lat": 25.696,
    "lng": -80.3011
  }, {
    "id": 0,
    "nazwa": "Ingleside Village Pizza",
    "lat": 32.8538,
    "lng": -83.6574
  }, {
    "id": 0,
    "nazwa": "Ciao Bella Pizza Da Guglielmo",
    "lat": 30.3956,
    "lng": -86.5121
  }, {
    "id": 0,
    "nazwa": "Papa John's Pizza",
    "lat": 32.5939,
    "lng": -83.6371
  }, {
    "id": 0,
    "nazwa": "Papa John's Pizza: East Central Montgomery",
    "lat": 32.3811,
    "lng": -86.273
  }, {
    "id": 0,
    "nazwa": "Cici's Pizza",
    "lat": 32.3822,
    "lng": -86.1907
  }, {
    "id": 0,
    "nazwa": "Papa John's Pizza",
    "lat": 30.8491,
    "lng": -83.9634
  }, {
    "id": 0,
    "nazwa": "Papa John's Pizza",
    "lat": 31.614,
    "lng": -84.2231
  }, {
    "id": 0,
    "nazwa": "Mellow Mushroom Pizza Bakers",
    "lat": 32.5321,
    "lng": -84.9559
  }, {
    "id": 0,
    "nazwa": "Star Pizza",
    "lat": 29.7325,
    "lng": -95.4111
  }, {
    "id": 0,
    "nazwa": "Star Pizza II",
    "lat": 29.7708,
    "lng": -95.396
  }, {
    "id": 0,
    "nazwa": "Brothers Pizzeria",
    "lat": 29.7683,
    "lng": -95.6436
  }, {
    "id": 0,
    "nazwa": "11th Street Cafe Inc",
    "lat": 29.7908,
    "lng": -95.3889
  }, {
    "id": 0,
    "nazwa": "California Pizza Kitchen",
    "lat": 29.7502,
    "lng": -95.4612
  }, {
    "id": 0,
    "nazwa": "Collina's Italian Cafe",
    "lat": 29.7326,
    "lng": -95.439
  }, {
    "id": 0,
    "nazwa": "Barry's Pizza & Italian Diner",
    "lat": 29.7314,
    "lng": -95.4844
  }, {
    "id": 0,
    "nazwa": "Mario's Seawall Italian Restaurant",
    "lat": 29.3045,
    "lng": -94.7726
  }, {
    "id": 0,
    "nazwa": "Campisi's Egyptian Restaurant",
    "lat": 32.8365,
    "lng": -96.7718
  }, {
    "id": 0,
    "nazwa": "Fat Joe's Pizza Pasta & Bar",
    "lat": 33.0271,
    "lng": -96.7889
  }, {
    "id": 0,
    "nazwa": "Saccone's Pizza",
    "lat": 29.5695,
    "lng": -97.9647
  }, {
    "id": 0,
    "nazwa": "Fireside Pies",
    "lat": 32.8198,
    "lng": -96.7841
  }, {
    "id": 0,
    "nazwa": "Romeo's",
    "lat": 30.2615,
    "lng": -97.76
  }, {
    "id": 0,
    "nazwa": "Sandella's Cafe",
    "lat": 32.892,
    "lng": -96.9612
  }, {
    "id": 0,
    "nazwa": "Mangia Chicago Stuffed Pizza",
    "lat": 30.3015,
    "lng": -97.7391
  }, {
    "id": 0,
    "nazwa": "Frank & Angie's",
    "lat": 30.2694,
    "lng": -97.7509
  }, {
    "id": 0,
    "nazwa": "Pizzeria Bianco",
    "lat": 33.4494,
    "lng": -112.066
  }, {
    "id": 0,
    "nazwa": "Sammy's Woodfired Pizza",
    "lat": 32.7134,
    "lng": -117.161
  }, {
    "id": 0,
    "nazwa": "Casa Bianca Pizza Pie",
    "lat": 34.1392,
    "lng": -118.205
  }, {
    "id": 0,
    "nazwa": "Parkway Grill",
    "lat": 34.137,
    "lng": -118.147
  }, {
    "id": 0,
    "nazwa": "California Pizza Kitchen",
    "lat": 34.0533,
    "lng": -118.253
  }, {
    "id": 0,
    "nazwa": "B J's Pizza & Grill",
    "lat": 33.6581,
    "lng": -118.001
  }, {
    "id": 0,
    "nazwa": "B J's Restaurant & Brewhouse",
    "lat": 33.5421,
    "lng": -117.784
  }, {
    "id": 0,
    "nazwa": "Beau Jo's Pizza",
    "lat": 39.6673,
    "lng": -104.941
  }, {
    "id": 0,
    "nazwa": "Pasquini's Pizzeria",
    "lat": 39.6928,
    "lng": -104.987
  }, {
    "id": 0,
    "nazwa": "Fargos Pizza Co",
    "lat": 38.8398,
    "lng": -104.774
  }, {
    "id": 0,
    "nazwa": "Old Chicago",
    "lat": 39.7482,
    "lng": -105.001
  }, {
    "id": 0,
    "nazwa": "Sink",
    "lat": 40.0082,
    "lng": -105.276
  }, {
    "id": 0,
    "nazwa": "Ligori's Pizza & Pasta",
    "lat": 41.1827,
    "lng": -111.949
  }, {
    "id": 0,
    "nazwa": "Old Chicago",
    "lat": 40.0176,
    "lng": -105.281
  }, {
    "id": 0,
    "nazwa": "Boston's Restaurant & Sports",
    "lat": 44.1069,
    "lng": -103.205
  }, {
    "id": 0,
    "nazwa": "Chuck E Cheese's Pizza",
    "lat": 45.7714,
    "lng": -108.576
  }, {
    "id": 0,
    "nazwa": "Space Aliens Grill & Bar",
    "lat": 46.8381,
    "lng": -100.772
  }, {
    "id": 0,
    "nazwa": "2nd Street Bistro",
    "lat": 45.661,
    "lng": -110.561
  }, {
    "id": 0,
    "nazwa": "Domino's Pizza",
    "lat": 48.2197,
    "lng": -101.296
  }, {
    "id": 0,
    "nazwa": "American Classic Pizzeria",
    "lat": 45.7841,
    "lng": -108.56
  }, {
    "id": 0,
    "nazwa": "Godfather's Pizza",
    "lat": 45.8151,
    "lng": -108.471
  }, {
    "id": 0,
    "nazwa": "Papa John's Pizza",
    "lat": 45.8102,
    "lng": -108.472
  }, {
    "id": 0,
    "nazwa": "Aardvark Pizza & Sub",
    "lat": 51.1765,
    "lng": -115.571
  }, {
    "id": 0,
    "nazwa": "Jasper Pizza Place",
    "lat": 52.8791,
    "lng": -118.079
  }, {
    "id": 0,
    "nazwa": "Odyssey Pizza & Steak House",
    "lat": 51.0452,
    "lng": -114.141
  }, {
    "id": 0,
    "nazwa": "Basil's Pizza",
    "lat": 51.024,
    "lng": -114.11
  }, {
    "id": 0,
    "nazwa": "Castle Pizza & Donair",
    "lat": 50.9845,
    "lng": -114.083
  }, {
    "id": 0,
    "nazwa": "Santa Lucia Italian Restaurant",
    "lat": 51.0892,
    "lng": -115.359
  }, {
    "id": 0,
    "nazwa": "Tops Pizza & Steak House No 3",
    "lat": 51.1012,
    "lng": -114.071
  }, {
    "id": 0,
    "nazwa": "Evvia Restaurant",
    "lat": 51.0892,
    "lng": -115.362
  }, {
    "id": 0,
    "nazwa": "D&#39;Bronx",
    "lat": 39.0572,
    "lng": -94.6061
  }, {
    "id": 0,
    "nazwa": "Cicero's Restaurant & Entrtnmt",
    "lat": 38.6563,
    "lng": -90.3084
  }, {
    "id": 0,
    "nazwa": "Hideaway Pizza",
    "lat": 35.5391,
    "lng": -97.5298
  }, {
    "id": 0,
    "nazwa": "Fortel's Pizza Den",
    "lat": 38.5664,
    "lng": -90.3208
  }, {
    "id": 0,
    "nazwa": "Hideaway Pizza",
    "lat": 36.0899,
    "lng": -95.8892
  }, {
    "id": 0,
    "nazwa": "Farotto's Catering",
    "lat": 38.6093,
    "lng": -90.3644
  }, {
    "id": 0,
    "nazwa": "California Pizza Kitchen",
    "lat": 38.6336,
    "lng": -90.3459
  }, {
    "id": 0,
    "nazwa": "D'Bronx",
    "lat": 39.0827,
    "lng": -94.5818
  }, {
    "id": 0,
    "nazwa": "Giuseppe's Depot Restaurant",
    "lat": 38.8345,
    "lng": -104.828
  }, {
    "id": 0,
    "nazwa": "Old Chicago",
    "lat": 39.7482,
    "lng": -105.001
  }, {
    "id": 0,
    "nazwa": "Brick Oven Restaurant",
    "lat": 40.2445,
    "lng": -111.656
  }, {
    "id": 0,
    "nazwa": "Zachary's Chicago Pizza",
    "lat": 37.8462,
    "lng": -122.252
  }, {
    "id": 0,
    "nazwa": "Zachary's Chicago Pizza",
    "lat": 37.8914,
    "lng": -122.278
  }, {
    "id": 0,
    "nazwa": "Cheese Board Pizza",
    "lat": 37.88,
    "lng": -122.269
  }, {
    "id": 0,
    "nazwa": "Goat Hill Pizza",
    "lat": 37.7624,
    "lng": -122.398
  }, {
    "id": 0,
    "nazwa": "Tommaso Ristorante Italiano",
    "lat": 37.7974,
    "lng": -122.405
  }, {
    "id": 0,
    "nazwa": "Little Star Pizza LLC",
    "lat": 37.7775,
    "lng": -122.438
  }, {
    "id": 0,
    "nazwa": "Pauline's Pizza",
    "lat": 37.7687,
    "lng": -122.422
  }, {
    "id": 0,
    "nazwa": "Villa Romana Pizzeria & Rstrnt",
    "lat": 37.7641,
    "lng": -122.466
  }, {
    "id": 0,
    "nazwa": "Amici's East Coast Pizzeria",
    "lat": 37.5639,
    "lng": -122.325
  }, {
    "id": 0,
    "nazwa": "Amici's East Coast Pizzeria",
    "lat": 37.5205,
    "lng": -122.252
  }, {
    "id": 0,
    "nazwa": "North Beach Pizza",
    "lat": 37.5653,
    "lng": -122.323
  }, {
    "id": 0,
    "nazwa": "Patxi's Chicago Pizza",
    "lat": 37.4451,
    "lng": -122.164
  }, {
    "id": 0,
    "nazwa": "Pizz'a Chicago",
    "lat": 37.4141,
    "lng": -122.126
  }, {
    "id": 0,
    "nazwa": "California Pizza Kitchen",
    "lat": 37.4481,
    "lng": -122.159
  }, {
    "id": 0,
    "nazwa": "Windy City Pizza",
    "lat": 37.5516,
    "lng": -122.315
  }, {
    "id": 0,
    "nazwa": "Applewood Pizza 2 Go",
    "lat": 37.453,
    "lng": -122.182
  }, {
    "id": 0,
    "nazwa": "Pizza Antica",
    "lat": 37.3218,
    "lng": -121.948
  }, {
    "id": 0,
    "nazwa": "Pizz'a Chicago",
    "lat": 37.3333,
    "lng": -121.892
  }, {
    "id": 0,
    "nazwa": "House of Pizza",
    "lat": 37.3264,
    "lng": -121.888
  }, {
    "id": 0,
    "nazwa": "Amici's East Coast Pizzeria",
    "lat": 37.3347,
    "lng": -121.894
  }, {
    "id": 0,
    "nazwa": "Fiorillo's Restaurant",
    "lat": 37.3546,
    "lng": -121.943
  }, {
    "id": 0,
    "nazwa": "Tony & Alba's Pizza & Pasta",
    "lat": 37.3233,
    "lng": -121.952
  }, {
    "id": 0,
    "nazwa": "Giorgio's",
    "lat": 37.2746,
    "lng": -121.893
  }, {
    "id": 0,
    "nazwa": "Round Table Pizza",
    "lat": 37.3159,
    "lng": -121.978
  }]
};
html,
body,
#mapka {
  height: 500px;
  width: 500px;
  margin: 0px;
  padding: 0px
}
<script src="https://maps.googleapis.com/maps/api/js"></script>
<script src="http://www.openjs.com/scripts/jx/jx.js"></script>
<script src="http://google-maps-utility-library-v3.googlecode.com/svn/tags/markermanager/1.0/src/markermanager.js"></script>
<div id="mapka" style="border: 2px solid #3872ac;"></div>