stefan.haglund-esri-se-esridist

Adding rasters located on network to mosaic with Python

Discussion created by stefan.haglund-esri-se-esridist on Nov 28, 2013
Latest reply on Nov 28, 2013 by rlwatson
Hello folks!

[EDIT: Never mind:blush:! UNC paths of ocurse!]

I am not able to add rasters to a mosaic dataset from rasters located on a fileshare through python.

If I add rasters using the code from my c: drive, no problem. Using the "Add Rasters..." tool in ArcMap to add rasters on the fileshare also works but for my workflow I need to use Python.

When I use the script to try and add rasters from the fileshare the script runs ok, including reading the path to the raster, but no rasters are added to my mosaic.

I have this (simplified) code:

import arcpy
import os

mdname = r'C:\MyFolder\MyGDB.gdb\MyMos'
rastype = "Raster Dataset"

#This works:
inpath = r'C:\DataFolder\Raster.asc'

#This does not:
#inpath = r'X:\DataFolder\Raster.asc'

updatecs = "UPDATE_CELL_SIZES"
updatebnd = "UPDATE_BOUNDARY"
updateovr = "NO_OVERVIEWS"
maxlevel = "2"
maxcs = "#"
maxdim = "#"
spatialref = "#"
inputdatafilter = "#"
subfolder = "NO_SUBFOLDERS"
duplicate = "EXCLUDE_DUPLICATES"
buildpy = "NO_PYRAMIDS"
calcstats = "NO_STATISTICS"
buildthumb = "NO_THUMBNAILS"
comments = "Add Raster Datasets"
forcesr = "#"

arcpy.AddRastersToMosaicDataset_management(mdname,  rastype, inpath, updatecs, \
                                           updatebnd, updateovr, maxlevel, maxcs, \
                                           maxdim, spatialref, inputdatafilter, \
                                           subfolder, duplicate, buildpy, calcstats, \
                                           buildthumb, comments, forcesr)


My path �??X:\DataFolder\Raster.asc�?� is a connected folder (in both Windows and ArcGIS) that points to \\servername\filearea\DataFolder\Raster.asc

I have also tried connecting through \\MyOrganisation.local\filearea\DataFolder\Raster.asc but with no result.

Has anybody seen a similar problem and can give some pointers?

Thanks!

Outcomes