0

I have made a custom map using the Google Maps API but the map keeps looping from left to right to infinity. Is there a way to fix it? https://i.sstatic.net/f5yA7mM6.png

    var map = new google.maps.Map(document.getElementById('map'), mapOptions);

    var customMapType = new google.maps.ImageMapType({
        getTileUrl: function(coord, zoom) {
            if (zoom < 0 || zoom > maxZoom) return "";
    
            var cols = baseCols * Math.pow(2, zoom);
            var rows = baseRows * Math.pow(2, zoom);
    
            if (coord.x < 0 || coord.x >= cols || coord.y < 0 || coord.y >= rows) {
                return null;
            }
    
            return 'tiles/' + zoom + '/' + coord.y + "_" + coord.x + ".png";
        },
        tileSize: new google.maps.Size(256, 256),
        minZoom: 0,
        maxZoom: maxZoom,
        name: 'custom',
        opacity: 1
    });

    map.mapTypes.set('custom', customMapType);
    map.setMapTypeId('custom');

Tried adding noWrap: true and tried couple of more things.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.