Best Practices and Overwriting vector tile service with arcpy

436
1
06-08-2022 08:40 AM
Tiffany_Wu
New Contributor III

I am working to publish a vector tile layer to reduce storage size and drawing/loading times that will be a visual layer in my map. It is a nation-wide dataset that is quite large, so I will need to minimize storage size. I am fairly new to tiles and wanted to ask about best practices and what might be the most efficient workflow for my project.

To automate the process, I am writing a Python script that will do the analysis and overwrite the tile layer. Is there any one method, and way of building the tile layer, that is best supported by recent Python functions and scripts? For example, I know that the "getWebLayerSharingDraft" function is newer and more efficient than the other "CreateWebLayerSDDraft" function. 

Do vector tile layers take up less space than tile layers, generally? Does including a hosted feature layer with the vector tile layer increase the file size? I would need the tiling scheme to go from continent to houses, so a pretty wide range. Currently I have two tile layers, one as a vector tile layer (ranging from 60MB to 140MB depending on tiling scheme) and one as a normal tile layer (8MB only) to divide up visibility scales but it would be great to combine the two.

Any advice is much appreciated, thank you!

1 Reply
Brian_Wilson
Occasional Contributor III

My workflow involves building the tile package locally and then uploading it as two separate steps. I can see what the size of the package is and test it before uploading it. 

My service level covers our county so it's tiny compared to yours. My previous raster service was several GB and took hours to cache (Maybe 4?) The current vector service takes maybe 10 minutes to generate. I make three files, one has labels only, one has shapes, and one has both. The labels and unlabeled services are stacked in our web maps. Better visually and you can turn off the labels separately this way. The entire county combined package file is 16M. That goes from zoom levels 9 to 20, so very good detail.

I use the "replace layer" feature, I don't overwrite. My script writes a new service with a datestamp to identify it, then I can do QA and testing with the new vector service, and then as a separate step once the new service has passed testing I have a script to do the "replace".  "Replace" moves the new service into place and renames the old one. Once I see the new service is working I delete the old one. 

I think this is the way that every "publish" process should work -- it should give you a chance to QA the service before releasing it, and then not require altering every map because the ID changed. Every other Esri service falls short.

In fact the hangup I have right now is that Esri does not support querying on the vectors, so I have to generate separate feature layers just for queries and I still have all the same hoops to jump through when publishing those.

I have released all the code for this project in github. The vector portions are working pretty smoothly. You'd want to look at "process_data.py" and "release_services.py". I see there is still an old raster tile script in that repository and some fancy code to generate thumbnails that is currently disabled. The README talks about what parts are working and will be of interest to you. Ask questions, I am actively working on this project. 

https://github.com/bwilsoncc/basemap

You can see the vector tiles in operation on our public web map, there are two layers,  "Clatsop County Labels" and "Clatsop County". https://delta.co.clatsop.or.us/apps/ClatsopCounty/

 

0 Kudos