Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/440.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用javascript在离线地图中获得更快的更新_Javascript_Google Maps - Fatal编程技术网

如何使用javascript在离线地图中获得更快的更新

如何使用javascript在离线地图中获得更快的更新,javascript,google-maps,Javascript,Google Maps,我想在我的谷歌离线地图上有一个更快的更新。加载脱机地图时出现闪烁问题。我使用了一些“Z索引”方法来避免闪烁。关于更快更新和避免每次加载地图时闪烁的任何其他建议 function jsCallFn(msg){ if(current_canvas=='map-canvas'){ current_canvas= 'map-canvas2'; }else{ current_canvas= 'map-canvas'; } initialize

我想在我的谷歌离线地图上有一个更快的更新。加载脱机地图时出现闪烁问题。我使用了一些“Z索引”方法来避免闪烁。关于更快更新和避免每次加载地图时闪烁的任何其他建议

function jsCallFn(msg){
    if(current_canvas=='map-canvas'){
        current_canvas= 'map-canvas2';
    }else{
        current_canvas= 'map-canvas';
    }
    initialize(msg);

    setTimeout(function() {
        if(current_canvas=='map-canvas'){
            $('#map-canvas').css('z-index','999');
            $('#map-canvas2').css('z-index','1');
        }else{
            $('#map-canvas2').css('z-index','999');
            $('#map-canvas').css('z-index','1');
        }
    }, 300);
}   

做一个小伙子,给它添加一些描述,说明它为什么起作用,甚至做了什么。
var mapTypeIds = [];
        for (var type in google.maps.MapTypeId) {
            }

            mapTypeIds.push("GoogleRoadMaps");


           //Load Map of Zoom level 17,Whose centre is Current vehicle latitude and longitude
           map = new google.maps.Map(element, {
                center: new google.maps.LatLng(maplat,maplng),
                zoom: 17,
                mapTypeId: "GoogleRoadMaps",
                mapTypeControlOptions: {
                    mapTypeIds: mapTypeIds
                }
            });

            //load the tiles in the Map from the server
            map.mapTypes.set("GoogleRoadMaps", new google.maps.ImageMapType({
                getTileUrl: function (coord, zoom) {


                    return "http://127.0.0.1:8081/Map/"+ coord.x + "/" + coord.y + ".png";

                },
                tileSize: new google.maps.Size(256, 256),
                name: "GoogleRoadMaps",
                maxZoom: 17
            }));

          //Display marker corresponding to first vehicle  
          var marker1=new google.maps.Marker({
          position: new google.maps.LatLng(latOne,lngOne),
          icon: iconOne

          })

            marker1.setMap(map);//marker1 is mapped into map element
            //Click event on marker1 corresponding to 1st Car
            google.maps.event.addListener(marker1, 'click', function() {

                var actionJsonObj = "{ " + "\"method\":\"Marker1\"" + "\," + "\"params\":\""+obj.v2x[1].CarID +"\" }";//Json string for update the sidebar in java

                    JsHandler.jsFnCall(actionJsonObj);//Call to Javascript to Java interface
                });
                //above is my code for map updation