Create Vector Tile Package min and max scales not honored with arcpy script

515
3
Jump to solution
08-26-2019 02:53 PM
TraceStanford1
New Contributor III

I have a python script that I want to use to automate the creation of a VTPK. My issue is that the script does not actually use the min and max scales that I enter, but is only caching levels 0 - 19. If I run the tool within Pro, it will cache the correct levels, but running outside will only cache levels 0-19 no matter what I put in for the min/max scales. I've seen another discussion close to this here, but it seems unnecessarily complex for what I'm trying to accomplish. Has anyone else encountered this issue and found a solution? Here is just a basic version of the code I'm trying to get to work, using an existing tiling scheme

import arcpy

arcpy.env.workspace = <workspace path>
arcpy.env.overwriteOutput = True

aprx = arcpy.mp.ArcGISProject(<path to project>)
m = aprx.listMaps()[0]
vtpk = <path of vtpk>
tiling_scheme = <path to tiling scheme>\VTTS_3567_NAD_1983_StatePlane_Utah_South_FIPS_4303_Feet.xml"
min_scale = 537922.337401
max_scale = 65.664348


arcpy.management.CreateVectorTilePackage(m, vtpk, "EXISTING", tiling_scheme, "INDEXED", min_scale, max_scale, None, '', '')
1 Solution

Accepted Solutions
GillianElliott
Esri Contributor

This is a known defect in ArcGIS Pro 2.4. The Create Vector Tile Package tool does not honor the min_cached_scale and max_cached_scale parameters when run from Python, and the workaround is to run the Create Vector Tile Package as a geoprocessing tool in Pro. Development is aware of this bug.

View solution in original post

0 Kudos
3 Replies
GillianElliott
Esri Contributor

This is a known defect in ArcGIS Pro 2.4. The Create Vector Tile Package tool does not honor the min_cached_scale and max_cached_scale parameters when run from Python, and the workaround is to run the Create Vector Tile Package as a geoprocessing tool in Pro. Development is aware of this bug.

View solution in original post

0 Kudos
DavidColey
Regular Contributor III

HI Gillian - I'm glad I did a search on this I was going nuts, experiencing the same exact issue as the poster Trace Stanford‌. I am at Pro 2.4.2

Thanks,

David

FrankCampbell-Gillies
New Contributor

So the esri community is aware of what they can do to properly REFERENCE and ESCALATE this bug with Esri: Login to your My Esri account and go here (BUG-000124749)

https://my.esri.com/#/support/bugs/BUG-000124749

Click Escalate with the number of users affected (many in our case) and business justification for escalation.

My understanding is that despite this bug being identified all the way back on 8/23/2019 with 2.4.x the issue was not resolved in 2.4.2 and is unlikely to be resolved in 2.4.3.  I can only imagine this is because of priorities resulting from a lack of escalation.  From my perspective - this bug produces VTPK files that our clients cannot use (we cannot zoom in on equipment like poles and fuses that are drawn close together spatially - the features completely disappear from the map as they start to spread apart and show labels) and a "workaround" of using the Desktop provides an unacceptable inability for our staff to fully automate (i.e. on a clock and with a computer, not with human hands) the scripted Vector Tile Package generation for the 18 or so regions we've compartmentalized across our company service territory.  We must have this fixed and until we can we are stuck frozen on ArcGIS Pro 2.3.2 on our MMPK/VTPK generation machine which creates security exceptions and software incompatibilities across our enterprise as we try to keep up with the esri ArcGIS Pro releases for other GIS deliverables.

- PacifiCorp IT GIS Team

p.s. Example of the line of Python code we ran - the "0" isn't being respected (most examples use 70.5310735 which looks to be the internal default it is now returning in the VTPK files.)

arcpy.management.CreateVectorTilePackage(vtpk_map, vtpk, "ONLINE", "", "INDEXED", 295828763.795777, 0)