2

I am setting up my own Map Tile Server according to this guide and it is working well now: http://switch2osm.org/serving-tiles/building-a-tile-server-from-packages/

The map currently has 19 zoom levels and it is initialized in the OpenLayers object "map" as below code shows:

map = new OpenLayers.Map ("map", {
            controls:[
                new OpenLayers.Control.Navigation(),
                new OpenLayers.Control.PanZoomBar(),
                new OpenLayers.Control.Permalink(),
                new OpenLayers.Control.ScaleLine({geodesic: true}),
                new OpenLayers.Control.Permalink('permalink'),
                new OpenLayers.Control.MousePosition(),                    
                new OpenLayers.Control.Attribution()],
            maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
            maxResolution: 156543.0339,
            numZoomLevels: 19,
            units: 'm',
            projection: new OpenLayers.Projection("EPSG:900913"),
            displayProjection: new OpenLayers.Projection("EPSG:4326")
        } );

I am wondering if I want to zoom beyond the maximum zoom level 19, say zoom into level 23 or even better, have my own zoom level reconfigured, how to do that? This is because I want to display an indoor room map on my current map server. The indoor room map is small it needs zoom level higher than 19.

Please point me to some resources to achieve this task as well.

2 Answers 2

2

When your user goes to level 20 or 23

You can redirect the tiles server to your own

function get_my_url (bounds) {
        var res = this.map.getResolution();
        var x = Math.round ((bounds.left - this.maxExtent.left) / (res * this.tileSize.w));
        var y = Math.round ((this.maxExtent.top - bounds.top) / (res * this.tileSize.h));
        var z = this.map.getZoom();
  new OpenLayers.Layer.TMS("Name", "http://example.com/", { 'type':'png', 'getURL':get_my_url });

You need to detect when level 20 is requested (z value)

http://trac.osgeo.org/openlayers/wiki/UsingCustomTiles

1

Yes, it is possible (although not that trivial at first sight).

Please study the following OpenLayers documentation: http://trac.osgeo.org/openlayers/wiki/SettingZoomLevels

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.