Как создать путь до папки с тайлами?

  • epol_pers
  • Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 4 months ago #11359 by epol_pers
Здравствуйте. Создал набор тайлов, через скрипт photoshop google maps tile cutter master и поместил тайлы в папку image. Теперь не могу разобраться, как прописать путь до этой папки в функции получения URL. В модуле отображается серый фон вместо карты. G
Attachments:

Please Log in or Create an account to join the conversation.

More
6 years 4 months ago - 6 years 4 months ago #11360 by Dima
Добрый вечер.
Все очень просто.
Вот мой абсолютый путь



Ну и Вы получаете



Т.е. Ваш абсолютый путь - куда вы установили весь ваш сайт, он как раз и является началом путей после слеша

Don't forget support my developments: post review in JED , donate , help with translation ;)
Attachments:
Last edit: 6 years 4 months ago by Dima.

Please Log in or Create an account to join the conversation.

  • epol_pers
  • Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 4 months ago #11361 by epol_pers
А как именно прописать их вот в этой функции?

function getNormalizedCoord(coord, zoom) {
if (!repeatOnXAxis) return coord;

var y = coord.y;
var x = coord.x;

// tile range in one direction range is dependent on zoom level
// 0 = 1 tile, 1 = 2 tiles, 2 = 4 tiles, 3 = 8 tiles, etc
var tileRange = 1 << zoom;

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

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

return {
x: x,
y: y
};

}


/*
* Main Core
*
*/

window.onload = function() {

// Define our custom map type
var customMapType = new google.maps.ImageMapType({
getTileUrl: function(coord, zoom) {
var normalizedCoord = getNormalizedCoord(coord, zoom);
if(normalizedCoord && (normalizedCoord.x < Math.pow(2, zoom)) && (normalizedCoord.x > -1) && (normalizedCoord.y < Math.pow(2, zoom)) && (normalizedCoord.y > -1)) {
return zoom + '_' + normalizedCoord.x + '_' + normalizedCoord.y + '.jpg';
} else {
return 'empty.jpg';
}
},
tileSize: new google.maps.Size(256, 256),
maxZoom: 6,
name: 'PS_Bramus.GoogleMapsTileCutter'
});

// Basic options for our map
var myOptions = {
center: new google.maps.LatLng(0, 0),
zoom: 2,
minZoom: 0,
streetViewControl: false,
mapTypeControl: false,
mapTypeControlOptions: {
mapTypeIds: ["custom"]
}
};

// Init the map and hook our custom map type to it
var map = new google.maps.Map(document.getElementById('map'), myOptions);
map.mapTypes.set('custom', customMapType);
map.setMapTypeId('custom');

}

Please Log in or Create an account to join the conversation.

Time to create page: 0.081 seconds

Donate


Go to top