Hi all
In ArcGIS 10.2 I'm trying to use the GP tool "Create Map Tile Package" or similarly with ArcPy arcpy.CreateMapTilePackage_management()
in either case it errors with:
Map description property must be set
Failed to execute (CreateMapTilePackage).
I don't see how or where to set the description in either the tool or with the python syntax given:
CreateMapTilePackage_management (in_map, service_type, output_file, format_type, level_of_detail, {service_file}, {summary}, {tags})
This works just fine in ArcMap using the menu - File > Share As > Tile Package because I can enter the required description field in the dialog.
Here is the syntax I tried in ArcPy:
elevation_mxd = "C:\\sub\\elevation.mxd"
elevation_tpk = "C:\\sub\\elevation.tpk"
# Process: Create Map Tile Package
arcpy.CreateMapTilePackage_management(elevation_mxd, "ONLINE", elevation_tpk, "PNG", "3", "", "summary", "tag tag2")
Hi Ken,
You will need to use the arcpy.mapping module and update the description using the MapDocument object. Here is an example:
mxd = arcpy.mapping.MapDocument(r"C:\temp\python\Airports.mxd")
mxd.description = "Philadelphia Airports"
mxd.save()
You should then be able to successfully create your map tile package.
Thanks very much Jake, that did the trick.
If you get a chance, be sure to mark this thread as answered to help other users in the community. Thanks!
Hi Jake,
I fortunately found this topic but I got an issue while I count not save the map description which I got an error:
Traceback (most recent call last):
File "<string>", line 254, in run_nodebug
File "C:\DEV\CWPP\TileMap.py", line 23, in <module>
College_station_mxd.save()
File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\utils.py", line 182, in fn_
return fn(*args, **kw)
File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\_mapping.py", line 850, in save
return convertArcObjectToPythonObject(self._arc_object.save(*gp_fixargs((), True)))
IOError: MapDocObject: Unable to save. Check to make sure you have write access to the specified file and that there is enough space on the storage device to hold your document.
I don't know how can solve this. Any idea?Thanks,
Peter
Hi Ping,
Make sure the MXD is not open when you execute your code.