[OpenLayers-Users] OSM base layer with TMS overlay

Jim White jbw2003 at earthlink.net
Mon Mar 10 16:04:33 PDT 2014


  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/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20140310/23d1ce79/attachment.html>


More information about the Users mailing list