arcgis online vector tile service in Leaflet map

1416
2
04-10-2018 06:25 AM
by Anonymous User
Not applicable

Greetings, I am trying to add an arcgis online served vector tiles service to a Leaflet map. I am using ( https://github.com/Leaflet/Leaflet.VectorGrid ) to add the vector tiles to a Leaflet v1.3.1 map application. 

I am able to add ESRI layers into the Leaflet map using the following simplified code: 

    var esriTilesUrl = "https://basemaps.arcgis.com/v1/arcgis/rest/services/World_Basemap/VectorTileServer/tile/{z}/{y}/{x}.pbf";

    var esriTilesPbfLayer = L.vectorGrid.protobuf(esriTilesUrl);

    esriTilesPbfLayer.addTo(map);

However, when I try to add my arcgis online vector tiles to the leaflet map using the same code

 

    var esriTilesUrl =  "https://tiles.arcgis.com/tiles/l4TwMwwoiuEVRPw9/arcgis/rest/services/CaryHouseHolds/VectorTileServer...{z}/{y}/{x}.pbf";    

    var esriTilesPbfLayer = L.vectorGrid.protobuf(esriTilesUrl);

    esriTilesPbfLayer.addTo(map);

I get the following error:

GET https://tiles.arcgis.com/tiles/l4TwMwwoiuEVRPw9/arcgis/rest/services/CaryHouseHolds/VectorTileServer... 404 ()

What is the correct url to use to consume arcgis online vector tiles?

Thanks, Tyler 

0 Kudos
2 Replies
yoannjaffrain
New Contributor

Hi Tyler ! I am also trying to add a custom Basemap (which seems to be a vector tile service since the url is https://basemaps.arcgis.com/arcgis/rest/services/World_Basemap_v2/VectorTileServer )

I can't make it work with leaflet.......

What was your solution?

0 Kudos
yoannjaffrain
New Contributor

I realize now that this URL cannot be correct because it doesn't take into account my customization.

So my question would : how do you display your ESRI custom basemap with leaflet ? (should use the id ?, ... ?)

Thanks !!!

0 Kudos