Skip to content
Snippets Groups Projects
Commit 95c379e7 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

imgae tiles that don't exist are not fetched by google maps api anymore

parent 4ace67d1
No related branches found
No related tags found
1 merge request!145Resolve "get rid of Google Maps 404 errors"
......@@ -157,27 +157,35 @@ AbstractCustomMap.prototype.createMapOptions = function () {
*/
AbstractCustomMap.prototype.createTypeOptions = function (param) {
var self = this;
var result = {
return {
// this is a function that will retrieve valid url to png images for
// tiles on different zoom levels
getTileUrl: function (coord, zoom) {
// we have 1 tile on self.getConfiguration().MIN_ZOOM and
// therefore must limit tails according to this
/* jshint bitwise: false */
var tileRange = 1 << (zoom - self.getMinZoom());
if (coord.y < 0 || coord.y >= tileRange || coord.x < 0 || coord.x >= tileRange) {
var maxTileRange = 1 << (zoom - self.getMinZoom());
var maxTileXRange = maxTileRange;
var maxTileYRange = maxTileRange;
var width = self.getModel().getWidth();
var height = self.getModel().getHeight();
if (width > height) {
maxTileYRange = height / width * maxTileRange;
} else if (width < height) {
maxTileXRange = width / height * maxTileRange;
}
if (coord.y < 0 || coord.y >= maxTileYRange || coord.x < 0 || coord.x >= maxTileXRange) {
return null;
}
var addr = "../map_images/" + param.getDirectory() + "/" + zoom + "/" + coord.x + "/" + coord.y + ".PNG";
return addr;
return "../map_images/" + param.getDirectory() + "/" + zoom + "/" + coord.x + "/" + coord.y + ".PNG";
},
tileSize: new google.maps.Size(this.getTileSize(), this.getTileSize()),
maxZoom: this.getMaxZoom(),
minZoom: this.getMinZoom(),
tileSize: new google.maps.Size(self.getTileSize(), self.getTileSize()),
maxZoom: self.getMaxZoom(),
minZoom: self.getMinZoom(),
radius: 360,
name: param.name
};
return result;
};
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment