Help on Vector Tile tools is incorrect

4265
15
Jump to solution
04-12-2016 08:20 AM
DougBrowning
MVP Esteemed Contributor

The help for the Vector Tile tools is wrong.  This code from the help does not work.  It keeps saying the value type for in_map is wrong.

Create Vector Tile Package—Data Management toolbox | ArcGIS for Desktop

p = arcpy.mp.ArcGISProject("c:\\temp\\myproject.aprx")

for m in p.listMaps():

print("Packaging" + m.name)

arcpy.CreateVectorTilePackage_management(m, m.name + '.vtpk', "INDEXED", 295828763.795777, 1128.497176)

It just has "Map" for the in_map when copied from the python snippet but that of course does not work in script. I have yet to find anything it likes.  Any hints?

arcpy.management.CreateVectorTilePackage("Map", r"C:\Vector\Settings.vtpk", "ONLINE", None, "INDEXED", 295828763.795778, 564.248588, r"C:\Vector\SettingsIndex.shp", None, None)

The tool to create the vector index will also not accept in_map.  Its help has a sample from some other tool??

Create Vector Tile Index—Data Management toolbox | ArcGIS for Desktop

The following Python window script demonstrates how to use the CreateVectorTileIndex tool in immediate mode.

import arcpy from arcpy 
import env 
env.workspace = "C:/data/cartography.gdb/transportation" 
arcpy.CreateIndexTiles_cartography("CURRENT", "tiles", 10000)

Also when copying the snippet from Pro it has another parameter with the value ONLINE that does not exist in the help.

#arcpy.management.CreateVectorTileIndex("Map", r"C:\Vector\SettingsIndex.shp", "ONLINE", None, 10000)

Please let me know the correct params or point me to help files that are correct.

Thanks

0 Kudos
1 Solution

Accepted Solutions
ColinLawrence
Esri Regular Contributor

Hi Doug,

I know it has been some time since you posted this but it looks like you are experiencing a bug that was recently logged.

BUG-000098329 - Create Vector Tile Package fails with "ERROR 000623: Invalid value type for parameter in_map" when run as a standalone script

The Create Vector Tile Package tool will run just fine in Pro and you should also be able to run it from the built in python window:

arcpy.env.workspace = "C:/TilePackageExample"

arcpy.CreateVectorTilePackage_management('Map', 'Example.vtpk', 'ONLINE')

The issue seems to occur when trying to run as a standalone script and it doesn't seem to recognize the input type. I hope this helps!

Colin

Regards,
Colin

View solution in original post

15 Replies
ColinLawrence
Esri Regular Contributor

Hi Doug,

I know it has been some time since you posted this but it looks like you are experiencing a bug that was recently logged.

BUG-000098329 - Create Vector Tile Package fails with "ERROR 000623: Invalid value type for parameter in_map" when run as a standalone script

The Create Vector Tile Package tool will run just fine in Pro and you should also be able to run it from the built in python window:

arcpy.env.workspace = "C:/TilePackageExample"

arcpy.CreateVectorTilePackage_management('Map', 'Example.vtpk', 'ONLINE')

The issue seems to occur when trying to run as a standalone script and it doesn't seem to recognize the input type. I hope this helps!

Colin

Regards,
Colin
AndyWright
Occasional Contributor

Colin,

Do you know if this bug is still present in 10.5?  I just ran into this in 10.4.1 and being able to create vector tile packages from standalone scripts is critical for us.  That's how we currently prepare tile packages for our customers and we need the ability to do the same thing with vector tiles.

0 Kudos
ColinLawrence
Esri Regular Contributor

Andy,

This tool coincides with ArcGIS Pro releases. It was logged at the current version (1.3) and version 1.4 is set to be released later this month. Unfortunately, I don't see any indication that this has been fixed for the 1.4 release.

This issue is caused by an invalid in_map parameter but fortunately there is a workaround. The arcpy.CreateVectorTilePackage_management function only recognize a map name as valid in_map parameter instead of a map object. The explanation of the in_map parameter in the Create Vector Tile Package tool documentation (Create Vector Tile Package—Data Management toolbox | ArcGIS for Desktop ) is incorrect by saying that in_map is "The map from which tiles are generated and packaged". Further, the sample codes in the documentation are incorrect too because it uses the map as Input Map instead of the map name.

For example, the following code will generate ERROR 000623:

p = arcpy.mp.ArcGISProject("c:\\temp\\myproject.aprx")
m = p.listMaps("Map")[0]
arcpy.CreateVectorTilePackage_management(m, m.name + '.vtpk', "ONLINE")

By modifying m to m.name, the code will work:

p = arcpy.mp.ArcGISProject("c:\\temp\\myproject.aprx")
m = p.listMaps("Map")[0]
arcpy.CreateVectorTilePackage_management(m.name, m.name + '.vtpk', "ONLINE")

Hopefully these issues (the bug and the documentation) will be resolved soon and this workaround allows you to continue your project successfully. 

Regards,
Colin
0 Kudos
AndyWright
Occasional Contributor

Hi Colin,

Thanks for the quick response.  I tried your suggestion with m.name and am getting a different error now:

ERROR 000735: Input Map: Value is required

arcpy.CreateVectorTilePackage_management(m.name, m.name + ".vtpk", "ONLINE")

0 Kudos
ColinLawrence
Esri Regular Contributor

Hi Andy,

Im sorry that didn't work. Please reach out to Tech Support so we can troubleshoot this issue for you. 

https://support.esri.com/contact-tech-support 

Thanks!

Regards,
Colin
0 Kudos
AndyWright
Occasional Contributor

Thanks Colin. Will do …

0 Kudos
AndyWright
Occasional Contributor

We did end up calling in an Esri support ticket, but none of Esri's resources could figure this out so it was logged as a bug.  In the meantime one of my co-workers cracked the nut on this one, albeit with a pretty obscure workaround.  We are definitely blaming the inadequate documentation for this debacle, although I still feel like supplying either the map object in the APRX or the name of that map should work.  So hopefully that gets addressed in a future version of Pro.

So what ended up working was exporting the map to a MAPX file.  You will find the tool to do that on the Share tab.  You can then supply the path and name to that MAPX file as your first parameter and the Python script will do its thing.  Now on to another vector tile issue - the inability to specify the extent for which you want to generate the vector tile package ...

0 Kudos
DougBrowning
MVP Esteemed Contributor

Andy - Since you are the only one I know making vector tiles maybe you know this.  

Have to found any way to have attributes at all?  Even just one attribute.  This blog post talks about changing the spot elevation response.  Esri Vector Basemaps: Updated Data and New Creative Style | ArcGIS Blog   But I see no way to do this for other layers.

Some map services let you point to a feature service when clicked.  This concept would be cool for vector tiles.

I also had an idea that if it can have 1 attribute as the blog post says that attribute could be a global id.  That global id would be used to build a query url into a HFS - returning the attributes in a pop up.

I have had luck burning in labels to the vtpk.  

My main issue has been when using a scene in AGO.  The vector tiles are fast but no attributes.  A HFS can not be used if there are more than 2000 features.

thanks for any hints

0 Kudos
AndyWright
Occasional Contributor

Hi Doug,

Unfortunately I can’t help you out here. Attributes are of paramount importance to my app so I don’t even mess with vector tiles in that vein. I use SQLite geodatabases under the hood for all my attribution needs.

0 Kudos