How to publish MDCS as a Geoprocessing Service on ArcGIS server

03-11-2014 02:01 PM
New Contributor

I am very new to ARCGIS and also Geo processing. I am trying to import the MDCS scripts in to Model Builder, execute it as a task and then publish the results in to ArcGIS server as a Geo processing service. Can anyone give me pointers on how to do it ? - These are the scripts I am referring to.

0 Kudos
3 Replies
MVP Esteemed Contributor

Old thread, but since I'm just being exposed to this (right now)....first, I noticed that the github download and the AGOL version are different....the one you get using the Open-Download seems to be more complete (includes demo data)

The file mentions

  1. Download and unzip the .zip file.
  2. Create a folder called Image_Mgmt_Workflow in the root of c: drive.
  3. Create a project folder in Image_Mgmt_Workflows
  4. Copy content of zip file to the project folder.

I unzipped and made sure to move the files directly under that folder (although may not really matter)

It's set up to work with 10.1 or 10.2, so to get this to work with 10.3, if needed you need to edit the c:\Image_Mgmt_Workflow\Initialize_Script_Paths.bat file (right click and edit using a text editor like NotePad+ or Wordpad).  Add reference to 10.3 (assuming default install)  I added lines 18-25 below...  This doesn't appear to be a deal breaker, but may help if you have 10.3 installed but never had 10.2 installed.

@echo off
set var=%cd%

rem This batch file will initialize the ArcGIS version number the sample files.
rem It will also set the current folder as the working folder in the batch files and script files. 

IF EXIST c:\python27\arcgis10.1\python.exe (

set id=10.1
goto :RunReplace

IF EXIST c:\python27\arcgis10.2\python.exe (

set id=10.2
goto :RunReplace


IF EXIST c:\python27\arcgis10.3\python.exe (

set id=10.3
goto :RunReplace


goto :ShowError

c:\python27\arcgis%id%\python.exe %var%\scripts\ %var%\batchFiles arcgisVer arcgis%id% *.bat
c:\python27\arcgis%id%\python.exe %var%\scripts\ %var%\batchFiles currFolder %var% *.bat
c:\python27\arcgis%id%\python.exe %var%\scripts\ %var%\Parameter\Config currFolder %var% *.xml

copy /y nul Reset_Script_Paths.bat
echo @echo off
echo @echo This batch file was automatically created after successfully executing Intialize_Script_Paths.bat. >Reset_Script_Paths.bat
echo. >>Reset_Script_Paths.bat
echo @echo This batch file will reset the ArcGIS version number and current folder location to be used by the Sample files. >>Reset_Script_Paths.bat
echo @echo The batch files will be reset to the state when you first downloaded the batch file. >>Reset_Script_Paths.bat
echo @echo Type Ctrl + C to cancel execution. >>Reset_Script_Paths.bat  
echo pause >>Reset_Script_Paths.bat  
echo. >>Reset_Script_Paths.bat  
echo c:\python27\arcgis%id%\python.exe %var%\scripts\ %var%\batchFiles arcgis%id% arcgisVer *.bat >>Reset_Script_Paths.bat
echo. >>Reset_Script_Paths.bat
echo c:\python27\arcgis%id%\python.exe %var%\scripts\ %var%\batchFiles %var% currFolder *.bat >>Reset_Script_Paths.bat
echo. >>Reset_Script_Paths.bat
echo c:\python27\arcgis%id%\python.exe %var%\scripts\ %var%\Parameter\Config %var% currFolder *.xml >>Reset_Script_Paths.bat
echo pause >>Reset_Script_Paths.bat  

ECHO "Successfully set ArcGIS version number to %id%."
ECHO "Successfully set sample paths to %var%."
goto :endofbatch 

ECHO "ERROR: Could not find Python Install Location in C:\python27\"


Then to be able to run the included demo, you need to edit the c:\Image_Mgmt_Workflow\BatchFiles\Amberg1.bat file (use a text editor again) to update your paths ...mine looks like:

@echo off
echo Calling MDCS for Amberg1.
c:\Python27\ArcGIS10.3\python.exe ..\Scripts\ -i:..\Parameter\Config\Amberg1.xml

I change the path to be ArcGIS10.3 (for mine) ....and the "currentpath" notation to ..  (two periods, DOS-speak for up-one-folder-level) but you can hardcode the path if you want.

EDIT: one more change....hardcode the path to the Data folder in the C:\Image_Mgmt_Workflow\Parameter\Config\Amberg1.xml file about line 19 ..make path name appropriate


I then double-clicked on the Amberg1.bat file and the demo script ran.  This created the demo mosaic dataset in C:\Image_Mgmt_Workflow\MD\Amberg.gdb

If the mosaic dataset is empty and the overviews are not creted, check you log in C:\Image_Mgmt_Workflow\Logs  folder....that will give you a clue if there is a path name issue anyway.

I wanted to document this for myself...comments are closed on the AGOL page.  Your GeoNet question here was the first (and only GeoNet question) that came up for me when I was searching for the figured I would put the info here.

Note: the demo that is being shown to us is showing a DLL solution for that, but for me it was a new install for the script.

EDIT:  I got it to work.  A few edits are above from my first post.  This just gets the demo to work....I still have to figure out how to do it in production.

0 Kudos
New Contributor II

It can be done with a toolbox, importing and calling it's main()-function with the two parameters

main(len(list), list)

The list needs to have at least 2 elements, one of them being the path to the xml file (because the command line or batch file delivers the path as one parameter). The execute script of the toolbox could be:


import sys
sys.path.insert(0, '...\mdcs-folder\scripts')
import arcpy
import MDCS
from pathlib import Path
import os

def ScriptTool(param0):
    config = "...\mdcs-folder\Parameter\Config\name.xml")).as_posix() 
    list = ["x", f"-i:{config}"]
    argc = len(liste)
    MDCS.main(argc, list)
if __name__ == '__main__':
    ordner_neue_Raster = arcpy.GetParameterAsText(0)


Half the answer is also given in this video at 23:14, but the script is not shown entirely...but it is propably more elegant.



0 Kudos
New Contributor II

my problem now is that I get "\Footprints is not registered with the server"

and "tool calculate field cannot use VB expressions as a service", when trying to publish a very simple MDCS with only Create MD and Add Rasters. What do I need to do?

0 Kudos