TPKX TPK Package Creation and Extraction problems

386
2
10-31-2023 09:23 AM
Labels (2)
MateuszJ
New Contributor

Hi guys.

I'm trying to create the tiles packages that can be used for offline purposes.

For the test purposes  create the package and then extract on my project via python terminal

I follow the guide for that ,but i'm getting errors while extracting. 

Does anyone could direct me or tell what i'm doing wrong here?

resources: 

https://pro.arcgis.com/en/pro-app/3.0/tool-reference/data-management/create-map-tile-package.htm
https://pro.arcgis.com/en/pro-app/3.0/arcpy/classes/extent.htm
https://pro.arcgis.com/en/pro-app/3.0/tool-reference/data-management/extract-package.htm

 

steps i perform on ArcGisPro 5.0 

crop the map(only one map in project WTP map) (right click on map > clip > clip to extent)
save project
open python terminal

p = arcpy.mp.ArcGISProject("C:\\my-progs\\esri\\mysuprtproj\\mysuprtproj.aprx")
for m in p.listMaps():
arcpy.management.CreateMapTilePackage(m, "ONLINE", "{}.tpk".format(m.name),
"PNG32", "2", extent="DISPLAY", min_level_of_detail="1")
result .\Map.tpkx

when i want to extract and getting error or following methods:
arcpy.management.ExtractPackage("C:\\my-progs\\esri\\mysuprtproj\\Map.tpkx")
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 12656, in ExtractPackage
raise e
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 12653, in ExtractPackage
retval = convertArcObjectToPythonObject(gp.ExtractPackage_management(*gp_fixargs((in_package, output_folder, cache_package, storage_format_type, create_ready_to_serve_format, target_cloud_connection), True)))
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 512, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000735: Processing %d row: Value is required
ERROR 000735: Processing %d row: Value is required
Failed to execute (ExtractPackage).

arcpy.management.ExtractPackage(r"C:\my-progs\esri\mysuprtproj\my.tpkx",
r"C:\my-progs\esri\mysuprtproj\Extracted", "CACHE",
"COMPACT", "READY_TO_SERVE_CACHE_DATASET")
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 12656, in ExtractPackage
raise e
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 12653, in ExtractPackage
retval = convertArcObjectToPythonObject(gp.ExtractPackage_management(*gp_fixargs((in_package, output_folder, cache_package, storage_format_type, create_ready_to_serve_format, target_cloud_connection), True)))
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 512, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000732: Input Package: Dataset C:\my-progs\esri\mysuprtproj\my.tpkx does not exist or is not supported
Failed to execute (ExtractPackage).

arcpy.management.ExtractPackage("C:\\my-progs\\esri\\mysuprtproj\\Map.tpkx",
"C:\\my-progs\\esri\\mysuprtproj\\Extracted", None,
"COMPACT", "READY_TO_SERVE_CACHE_DATASET")
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 12656, in ExtractPackage
raise e
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 12653, in ExtractPackage
retval = convertArcObjectToPythonObject(gp.ExtractPackage_management(*gp_fixargs((in_package, output_folder, cache_package, storage_format_type, create_ready_to_serve_format, target_cloud_connection), True)))
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 512, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: ERROR 999999: Something unexpected caused the tool to fail. Contact Esri Technical Support (http://esriurl.com/support) to Report a Bug, and refer to the error help for potential solutions or workarounds.
Failed to execute (ExtractPackage).

0 Kudos
2 Replies
HaydenWelch
Occasional Contributor

> steps i perform on ArcGisPro 5.0

 

ArcPro is only on 3.3 currently. Are you using ArcMap? If so you won't have access to .tpkx files. only .tpk files.

 

Your errors are also parameter errors which means you're feeding the function invalid parameters, maybe try the workflow using regular GP tools then copy the generated arcpy commands and compare?

0 Kudos
StaticK
MVP

It helps to format your code and not add forum comments to it. Click the '...' > '</>' and paste your code in there.

Be explicit with your paths until you know it's working and then you adjust the code for relative paths. Maybe it converts it on its own, but  your initial map package name extension is missing the x in the file extension> "{}.tpk".format(m.name) Do you see the file created at: "C:\\my-progs\\esri\\mysuprtproj\\Map.tpkx"?

result .\Map.tpkx <- ? maybe it is from a previous run an the code is creating a Map.tpk at C:\?

arcpy.management.CreateMapTilePackage(m, "ONLINE", "{}.tpk".format(m.name),
"PNG32", "2", extent="DISPLAY", min_level_of_detail="1")

when i want to extract and getting error or following methods:
arcpy.management.ExtractPackage("C:\\my-progs\\esri\\mysuprtproj\\Map.tpkx")

0 Kudos