While you can access the tile elements, you can clone them, but (provided that the interface is now the same), they seem to be absolutely placed img tags in OpenStreetMap - the div reset, d you need to either clone the img elements themselves (and use instead, with a different positioning, assuming it works with the library), either create a div , pull out the URL from the image and apply it as a background for you div . Since the tiles are logically numbered, if you know the area you want, you can simply skip this step, maybe something like this:
var startX = 7, endX = 8, startY = 3, endY = 10, scale = 5, $parent = $('<div class="map"></div>'); for (var y = startY; y <= endY; y++) { var $row = $('<div class="tile-row"></div>'); for (var x = startX; x <= endX; x++) { $row.append( $('<img />') .attr('src', 'http://path.to.images/'+scale+'/'+x+'/'+y'.png'); ); // or: // $('<div></div>') // .css('background-image', 'http://path.to.images/'+scale+'/'+x+'/'+y'.png'); }; $parent.append($fold); };
The native OpenStreetMap format probably does not lend itself to this particular library (especially with its absolutely positioned images), so I think you will need to imitate its layout with a more position: static structure, avoiding absolute positions and splitting into contained lines that can be folded.
Truffula
source share