indoor map

295 views
Skip to first unread message

guillaume

unread,
Feb 26, 2013, 12:45:04 AM2/26/13
to leafl...@googlegroups.com
Hi,
I have been trying to use leaflet for indoor maps without success, even the latest release 0.5 which is supposed to bring support for cartesian crs.
Please note that I am using maptiler to create my maps from png images.
So far, I managed to display my indoor map with openlayers but I really want to use leaflet.

Here is what works with openlayers but what could be the equivalent with Leaflet?
thanks

    var map, layer, poi, select;
    var mapBounds = new OpenLayers.Bounds( 0, 150, 150, 0);     //Boundaries: left, bottom, right, top).              
    var map_folder     = '/mypathtothemapfolder';   
 
    var map_default_options = {
        controls: [],
        maxExtent: mapBounds,
        maxResolution: 16.000000,
        numZoomLevels: 5
    };   

    var layer_default_options = {
        serviceVersion: '.',
        layername:         '.',
        alpha:             true,
        type:             'png',
        getURL:         overlay_getTileURL
    };
 
   
    $(window).load(function() {
       
        map     = new OpenLayers.Map('map', map_default_options);
        layer     = new OpenLayers.Layer.TMS( "TMS Layer",map_folder,layer_default_options);       
    
       
        //Add layers
        map.addLayer(layer);   

...
});
    function overlay_getTileURL(bounds) {
        var res = this.map.getResolution();
        var x = Math.round((bounds.left - this.maxExtent.left) / (res * this.tileSize.w));
        var y = Math.round((bounds.bottom - this.maxExtent.bottom) / (res * this.tileSize.h));
        var z = this.map.getZoom();
        if (x >= 0 && y >= 0) {
            return this.url + z + "/" + x + "/" + y + "." + this.type;               
        } else {
            return "http://www.maptiler.org/img/none.png";
        }
    }

Matt Goodman

unread,
Mar 1, 2013, 12:44:07 PM3/1/13
to leafl...@googlegroups.com
I couldn't get Cartesian crs to work personally :(  Lemme know if you have any success in this avenue.  
Reply all
Reply to author
Forward
0 new messages