I can’t find any examples of how to integrate with leafletjs online. can someone please show me a way to add a TileLayer from this api?
Hi Josh,
have you seen our tutorial here: https://rapidapi.com/MapTilesApi/api/retina-tiles/tutorials/using-retina-tiles-with-leaflet-to-display-a-map-on-a-website ?
As a TileLayer URL in Leaflet you would need:
https://retina-tiles.p.rapidapi.com/local/osm{r}/v1/{z}/{x}/{y}.png?rapidapi-key=YOUR-RAPIDAPI-KEY
if you want Leaflet to choose between standard and retina tiles (Leaflet will then fill the {r}var with either @2xto retrieve retina tiles for high resolution displays or `` for displays without high resolution).
{r}
@2x
Otherwise you can use:
https://retina-tiles.p.rapidapi.com/local/osm@2x/v1/{z}/{x}/{y}.png?rapidapi-key=YOUR-RAPIDAPI-KEY
to always get retina tiles or
https://retina-tiles.p.rapidapi.com/local/osm/v1/{z}/{x}/{y}.png?rapidapi-key=YOUR-RAPIDAPI-KEY
to always get standard tiles.
In each case you’ll just have to replace YOUR-RAPIDAPI-KEY with your X-RapidAPI-Key and then you are good to go.
YOUR-RAPIDAPI-KEY
Junte-se à discussão - adicione o comentário abaixo:
Hi Josh,
have you seen our tutorial here: https://rapidapi.com/MapTilesApi/api/retina-tiles/tutorials/using-retina-tiles-with-leaflet-to-display-a-map-on-a-website ?
As a TileLayer URL in Leaflet you would need:
https://retina-tiles.p.rapidapi.com/local/osm{r}/v1/{z}/{x}/{y}.png?rapidapi-key=YOUR-RAPIDAPI-KEY
if you want Leaflet to choose between standard and retina tiles (Leaflet will then fill the
{r}
var with either@2x
to retrieve retina tiles for high resolution displays or `` for displays without high resolution).Otherwise you can use:
https://retina-tiles.p.rapidapi.com/local/osm@2x/v1/{z}/{x}/{y}.png?rapidapi-key=YOUR-RAPIDAPI-KEY
to always get retina tiles or
https://retina-tiles.p.rapidapi.com/local/osm/v1/{z}/{x}/{y}.png?rapidapi-key=YOUR-RAPIDAPI-KEY
to always get standard tiles.
In each case you’ll just have to replace
YOUR-RAPIDAPI-KEY
with your X-RapidAPI-Key and then you are good to go.