rstudio / leaflet

R Interface to Leaflet Maps
http://rstudio.github.io/leaflet/
Other
807 stars 508 forks source link

Why tms=TRUE in TileOptions not work #409

Closed danzhuibing closed 7 years ago

danzhuibing commented 7 years ago

I want to use Tencent Map in leaflet for R, but failed. Tecent Map is following in TMS standard, so I set tms=TRUE in TileOptions. But it does not work. Here is the full code:

leaflet() %>%
addTiles(
'http://rt1.map.gtimg.com/realtimerender?z={z}&x={x}&y={y}&type=vector&style=0',
  tileOptions(tms=TRUE, tileSize=256, minZoom=9, maxZoom=17),
  attribution = '&copy; Tencent Map</a>'
) %>% 
setView(116.40,39.90, zoom = 10)

But when I use leaflet in js, it works:

var mymap = L.map('mapid').setView([39.90, 116.40], 10);
L.tileLayer('http://rt1.map.gtimg.com/realtimerender?z={z}&x={x}&y={y}&type=vector&style=0', {
        maxZoom: 18,
        attribution: '&copy; Tencent Map ',
        tms: true
    }).addTo(mymap);

In addition, I found that some other options also not work, like subdomains.

bhaskarvk commented 7 years ago

You're passing it as the second argument which is not right. Pass it by explicitly setting the options argument.

danzhuibing commented 7 years ago

thanks~