Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I want to access arcgis server cache dircetly by only using leaflet,I wrote some code,but it work badly,could you anyone give me any hints? my code: getTileUrl: function (tilePoint) {

    var zoom = this._map.getZoom();

    var map = this._map;
    var crs = map.options.crs;

    var tileSize = this.options.tileSize;

    var nwPoint = tilePoint.multiplyBy(tileSize);
    var sePoint = nwPoint.add(new L.Point(tileSize, tileSize));
    var midX = (nwPoint.x + sePoint.x) / 2;
    var midY = (nwPoint.y + sePoint.y) / 2;
    var p = new L.Point(midX, midY);


    var tilep = crs.project(map.unproject(p, zoom));

    var z = zoom, x = tilep.x, y = tilep.y, url;

    url = this._url;
    var z1;
    if (z < 10)
    {
        z1 = 'L0' + z + '/';
    }
    else {
        z1 = 'L' + z + '/';
    }

    var row = Math.floor(Math.abs((this.options.tileOrigin.y - y) / (this.options.tileSize * this.options.res[z])));
    //console.info(row);
    var col = Math.floor(Math.abs((x - this.options.tileOrigin.x) / (this.options.tileSize * this.options.res[z])));
    //console.info(col);
    url = this._url + z1 + 'R' + this.zeroPad(row, 8, 16) + '/C' + this.zeroPad(col,8,16) + '.' + this.options.format;  
    return url;
}

It's inherited from TileLayer,and I just change this function.

share|improve this question
    
it would be helpful if we could see your code –  Kelso Sep 28 '12 at 4:39
    
why dont u use L.AgsDynamicLayer or L.TileLayer in leaflet? –  Aragon Sep 28 '12 at 6:33
    
@Aragon,I dont want to use ArcGIS server,but the data source is generated by arcgis server. –  MRChanged Sep 28 '12 at 8:08
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.