Select to view content in your preferred language

Public Vector Tile Won't Display in with Esri leaflet plugin

1422
1
Jump to solution
06-11-2021 09:49 AM
ZacStanley3
Occasional Contributor

Hello-

I'm simply trying to replace a draft version of a vector tile with a final version. Different service end points and no modes to code whatsoever. Seetings are identical in each service, but the updated service won't display.

Draft version I'm trying to replace, this one works:

https://tiles.arcgis.com/tiles/tdQLEzq0fgVElWN3/arcgis/rest/services/Draft_Lifeform_Vector_Tile_Pack...

Final version, this one doesn't work:

https://tiles.arcgis.com/tiles/tdQLEzq0fgVElWN3/arcgis/rest/services/Marin_County_Lifeform_Map_FINAL...

And here is a code snippet with CDNs etc.

<!-- Load Leaflet from CDN -->
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>

<!-- Esri Leaflet and Esri Leaflet Vector -->
<script src="https://unpkg.com/esri-leaflet/dist/esri-leaflet.js"></script>
<script src="https://unpkg.com/esri-leaflet-vector@3/dist/esri-leaflet-vector.js"></script>
<!-- Link to marin county boundary js file -->
<script src="GeoJsons/MarinBnd.js"></script>


<script>
// options to be used when creating the map
var options = {
center: [38.0828, -122.7551],
zoom: 10.4,
zoomSnap: .1,
zoomControl: true
}

var map = L.map('map', options);

// requests some map tiles
var tiles = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}', 'Tiles &copy; Esri &mdash; Esri, DeLorme, NAVTEQ, TomTom, Intermap, iPC, USGS, FAO, NPS, NRCAN, GeoBase, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), and the GIS User Community');

// add those tiles to our map element
map.addLayer(tiles);

// add county layer to map
const countyLayer = L.geoJson(county, {
style: function (feature) {
return {
opacity: 0, // set stroke opacity to zero
fillOpacity: 0 // set fill opacity to zero

};
}
});
countyLayer.addTo(map);

// request public vector tile layer from ArcGIS Online
L.esri.Vector.vectorTileLayer("https://tiles.arcgis.com/tiles/tdQLEzq0fgVElWN3/arcgis/rest/services/Marin_County_Lifeform_Map_FINAL...", {

// add service to map
}).addTo(map);

// make county layer zoom to fit screen
const macoZoom = countyLayer.getBounds()

// fit bounds to extent marin county boundary
map.fitBounds(macoZoom, {
maxzoom: 8
});

</script>

 

Would love it if anyone has any idea that would help solving this issue.

Thanks!

Zac

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
GavinRehkemper
Esri Contributor
0 Kudos
1 Reply
GavinRehkemper
Esri Contributor
0 Kudos