Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/453.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 google MarkerImage未显示的问题_Javascript_Google Maps_Google Maps Markers_Image Resizing - Fatal编程技术网

Javascript google MarkerImage未显示的问题

Javascript google MarkerImage未显示的问题,javascript,google-maps,google-maps-markers,image-resizing,Javascript,Google Maps,Google Maps Markers,Image Resizing,我正在尝试调整一些图标的大小,以便在带有MarkerImage的GMAP上显示它们,但它不起作用。如果我以正常方式加载,它会工作,代码: function addMyPos(latitud,longitud){ posi = new google.maps.LatLng(latitud,longitud) marker = new google.maps.Marker({ position: posi, map: map, icon: "../res/punto_negropru

我正在尝试调整一些图标的大小,以便在带有MarkerImage的GMAP上显示它们,但它不起作用。如果我以正常方式加载,它会工作,代码:

function addMyPos(latitud,longitud){
 posi = new google.maps.LatLng(latitud,longitud)
 marker = new google.maps.Marker({
  position: posi,
  map: map,
  icon: "../res/punto_negropru.png"
 });
}
但是图像太大了,所以我尝试使用MarkerImage,但不起作用:

function addMyPos(latitud,longitud){
 var imag = new google.maps.MarkerImage(
           "../res/sit_marron.png", 
           new google.maps.Size(26, 30), 
           new google.maps.Point(0,0), 
           new google.maps.Point(13,30) 
   );
posi = new google.maps.LatLng(latitud,longitud)
marker = new google.maps.Marker({
 position: posi,
 map: map,
 icon: imag
 });
}

请注意,我试图将所有类型的数字传递给point、size..等,但我无法调整大小,图像总是会消失。感谢您的帮助。

我相信,MarkerImage最近已从API中删除。尝试将代码的该部分更改为:

var imag = {
    url: "../res/sit_marron.png", 
    size: new google.maps.Size(26, 30), 
    origin: new google.maps.Point(0,0), 
    anchor: new google.maps.Point(13,30),
    scaledSize: new google.maps.Size(13, 15)
};

(将
scaledSize
的值更改为适当的值。我刚刚选择了一半大小作为示例。)

我已在您的代码中编辑了MarkerImage。尝试访问