在 google 地图上使用自定义图像(防止在 x 方向重复)

Using custom image on google maps (prevent repeating in x direction)

我想在 google 地图上使用我的轮廓图。因为我需要在上面添加标记、折线等。 我找到了这个例子:https://developers.google.com/maps/documentation/javascript/examples/maptype-image 但在这个例子中,图像重复 x 方向。我不知道为什么。有没有办法不重复使用图片?

要防止图像在 x 方向换行,请更改这部分代码:

// repeat across x-axis
if (x < 0 || x >= tileRange) {
  x = (x % tileRange + tileRange) % tileRange;
}

收件人:

// don't repeat across x-axis
if (x < 0 || x >= tileRange) {
  return null;
}

proof of concept fiddle