[OpenLayers-Users] OSM base layer with TMS overlay

Jim White jbw2003 at earthlink.net
Tue Mar 11 14:53:00 PDT 2014


Hi Arnd,

That seems to do the trick. Great.

Thanks,
Jim

On 03/11/2014 05:09 PM, Arnd Wippermann wrote:
> Hi,
> set the resolutions for the osm layer, then it should work:
>     var osm = new OpenLayers.Layer.OSM("Open Street Map", "",{
>             resolutions: [2445.984, 1222.99, 611.496, 305.748, 
> 152.874, 76.437, 38.218],
>             serverResolutions : 
> [156543.03390625,78271.516953125,39135.7584765625,19567.87923828125,9783.939619140625,4891.9698095703125,
> 2445.9849047851562,1222.9924523925781,611.4962261962891,305.74811309814453,152.87405654907226,76.43702827453613,
> 38.218514137268066,19.109257068634033,9.554628534317017,4.777314267158508,2.388657133579254,1.194328566789627,
>                 0.5971642833948135
>             ]
>         });
> Arnd
> http://gis.ibbeck.de/ginfo/apps/OLExamples/OLdev/OSM_restrictedZoomLevels.asp
>
> ------------------------------------------------------------------------
> *Von:* openlayers-users-bounces at lists.osgeo.org 
> [mailto:openlayers-users-bounces at lists.osgeo.org] *Im Auftrag von *Jim 
> White
> *Gesendet:* Dienstag, 11. März 2014 00:05
> *An:* jack at greenbaum.org; openlayers-users at lists.osgeo.org
> *Betreff:* [OpenLayers-Users] OSM base layer with TMS overlay
>
>  Hi,
>
> Here is what I have. You can see 4 base layers, and start of overlays 
> at end. Any of the 3 base layers Google, TMS, WMS selected will cause 
> overlay TMS to be displayed properly. Selecting OSM base layer selects 
> tiles with wrong zoom.
>
> With OSM as base layer it is incorrectly selecting tile such as this 
> with zoom 10, which is 6 too large
>
> http://tecumseh.zo.ncsu.edu/tilecache/1.0.0/huc10nc/10/11/7.png
>
> It should be asking for
>
> http://tecumseh.zo.ncsu.edu/tilecache/1.0.0/huc10nc/4/11/7.png
>
>
>
>   //////Base Layers
>     var gphy = new OpenLayers.Layer.Google("Google Physical", {
>         type: google.maps.MapTypeId.TERRAIN,
>         MAX_ZOOM_LEVEL: 12,
>         MIN_ZOOM_LEVEL: 6,
>         displayInLayerSwitcher: false,
>         visibility: false,
>         buffer: 0
>     });
>
>     var osm = new OpenLayers.Layer.OSM("Open Street Map");
>
>     var counties_base = new OpenLayers.Layer.TMS("None",
>         SERVER_URI + "tilecache/", {
>             layername: "counties",
>             type: "png",
>             tileOrigin: new OpenLayers.LonLat(-9462455, 3963396)
>         }
>     );
>
>     var hillshade = new OpenLayers.Layer.WMS("NC Hillshade",
>         SERVER_URI + "geoserver/wms", {
>             layers: "NC_Hill_3857_to",
>             format: 'image/png'
>         }, {
>             visibility: false,
>             displayInLayerSwitcher: false
>         });
>     ////////////////////////////////////////////////////////////
>     /// TMS line layers overlays
>     /////////////////////////////////////////////////////////
>
>
>     var nchuc2 = new OpenLayers.Layer.TMS("NC HUC 2",
>         SERVER_URI + "tilecache/", {
>             layername: "huc2nc",
>             type: "png",
>             isBaseLayer: false,
>             visibility: false,
>             tileOrigin: new OpenLayers.LonLat(-9462455, 3963396)
>         }
>     );On 03/10/2014 03:32 PM, jack at greenbaum.org wrote:
>> How are you creating the TMS layer? Are you using an OSM layer with the
>> TMS urls? If so that is you problem, TMS and OSM use opposite y dimension
>> mappings. Use a TMS layer instead.
>>
>> -- Jack
>>
>>> Someone pointed out that I could request tiles from tilecache using TMS
>>> instead of WMS, which I have done and it has mostly fixed my problems.
>>> However, if I use Open Street Map as my base layer then my TMS overlays
>>> are requesting the wrong tiles.
>>>
>>> If I don't get any suggestions from the list I am going to file a bug.
>>>
>>> Jim
>>>
>>>
>>>
>>> On 03/10/2014 03:00 PM,openlayers-users-request at lists.osgeo.org  wrote:
>>>> Is the baselayer you are trying to serve from WMS in 900913? Serving
>>>> from tilecache is only going to work if the tiles are in right project.
>>>> Try losing the tileorigin in the constructor as well.
>>> --
>>> James B. White
>>> Cary, NC
>>> H: 919-380-9615
>>> M: 919-698-1765
>>> White Coding and Maps<http://whitecodingandmaps.com/>
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
>
> -- 
> James B. White
> Cary, NC
> H: 919-380-9615
> M: 919-698-1765
> White Coding and Maps <http://whitecodingandmaps.com/>


-- 
James B. White
Cary, NC
H: 919-380-9615
M: 919-698-1765
White Coding and Maps <http://whitecodingandmaps.com/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20140311/e225cda5/attachment-0001.html>


More information about the Users mailing list