0

I created a map object and specified options according to Arcgis tiled map tiles.

        var options = {
            scales: [120000, 60000, 30000, 15000, 5000, 2500, 500],
            resolutions: [204, 61, 25, 12, 6, 3, 1, 0.5],
            maxExtent: new OpenLayers.Bounds(479368, 5436618, 698577, 4588478),
            minExtent: new OpenLayers.Bounds(-1, -1, 1, 1),
            minResolution: 0.5,
            maxResolution: 204,
            minScale: 400000,
            maxScale: 500,
            numZoomLevels: 10,
            projection: new OpenLayers.Projection("EPSG:50100"),
            controls:[]
        };

EPSG:50100 is my custom spatial reference that I saved on Geoserver.

I can use the Arcgis Tiles on my map like this.

    var arcgis = new OpenLayers.Layer.TMS("2012", "http://myurl/tiles/", {
            type: 'png',
            getURL: createUrl,
            isBaseLayer: true,
            tileOrigin: tileOrigin,
            serverResolutions: [204, 61, 25, 12, 6, 3, 1, 0.5]
        }
    );

createURL function is getting arcgis tiles specified rule. Like this.

Arcgis tiles are coming on my Map.

And I want to add OpenStreetMap tiles on same map.

  var osm = new OpenLayers.Layer.TMS( "OpenStreetMap",
                    "http://tile.openstreetmap.org/",
                    { 
                      type: 'png', 
                      getURL: osm_getTileURL, 
                      displayOutsideMaxExtent: true, 
                    });

But it is not appearing. Should I change Map options according to tile provider?

1

The OpenStreetMap tiles are pre-rendered in Web-Mercator (i.e. EPSG:3857) and hence you can't get them in your projection, and show it in this map.

You have two options:

  1. Tile your data in Web Mercator

  2. Download OSM data, and then create tiles for it your Projection.

  • may be a solution using proj4js transform openlayers while getURL? – barteloma Aug 22 '14 at 7:17
  • Proj4 is used for vectors and not rasters. And even if you project individual tiles, that does not mean that the tiling scheme can be converted – Devdatta Tengshe Aug 22 '14 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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