Select to view content in your preferred language

Data Driven page issues with ArcGIS Engine on Linux

733
1
08-26-2011 04:35 AM
DanSlayback
Deactivated User
I'm having some trouble with using the data drive pages functionality in linux. Perhaps I'm missing something obvious here, so if anyone has successfully used this, I'd appreciate any comments.

Neither dataDrivenPages.currentPageID or dataDrivenPages.getPageIDFromName work on my system, but both work in Windows, using the same input data.

The issue can be recreated easily: Create a new mxd in ArcMap. Add some basic background layer for reference (World Map or whatever). Create a new polygon shapefile in same directory where mxd is. Add several polygons. Add an item name in the polygon's attribute table, and assign each polygon a text name (optional). Save changes to shapefile. Setup data driven pages on the mxd, using that name item as the index. Set MXD to save as relative pathname. Save mxd. Close ArcMap.

Open a shell window in the directory where the mxd is located. Start python, import arcpy and attempt to use the above python methods. The results on Linux vs Windows are below. Note the returned pageID should be the same as the "Box" number. Eg Box2 is pageID = 2. Also, on my system, the directory where everything is located is the same for linux and Windows; Windows runs in a virtual machine and accesses the directory as a network drive.

Linux (CentOS 5.6, 64-bit, ArcGIS Engine 10.0 SP2):
-----------------------------------------------------------
$ source /usr/local/arcgis/engine10.0/init_engine.sh
$ source /usr/local/arcgis/engine10.0/python26/setenv_python.sh
$ python
Python 2.6.5 (r265:79063, Apr 27 2010, 11:08:55)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import arcpy
>>> mxd = arcpy.mapping.MapDocument('Test.mxd')
>>> pageID = mxd.dataDrivenPages.getPageIDFromName('Box2')
>>> pageID
0
>>> mxd.dataDrivenPages.currentPageID = 2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/arcgis/engine10.0/python26/lib/python2.6/site-packages/arcpy/arcpy/arcobjects/_base.py", line 77, in _set
    return setattr(self._arc_object, attr_name, ao)
ValueError: PageLayoutObject: Error in SetDataDrivenPageID
>>> quit()
-----------------------------------------------

Windows (Win7/64-bit, ArcGIS 10.0 SP2):
------------------------------------------------
>C:\Python26\ArcGIS10.0\python.exe
Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import arcpy
>>> mxd = arcpy.mapping.MapDocument('Test.mxd')
>>> pageID = mxd.dataDrivenPages.getPageIDFromName('Box2')
>>> pageID
2
>>> mxd.dataDrivenPages.currentPageID = 2
>>>
------------------------------------------------

Any clues as to whether I'm simply doing something wrong or this is a bug? I have had success doing many other operations on mxd's using ArcGIS Engine/Linux, but this particular method fails.
Tags (2)
0 Kudos
1 Reply
JohnGravois
Deactivated User
Dan and I were able to determine that the issue was the result of the drive mapping in certain MXDs on his Windows virtual machine.  Individual layers were in some instances pathed as "//vmware-host/Shared Folders" and in other cases as "H:" which he had mapped to the same location.

After removing the data driven pages index layer, saving a copy of the map, and then re-adding it (making sure to use the //vmware-host/ root path), python behaved as expected.
0 Kudos