Select to view content in your preferred language

how to publish mxd with defined layers as GPService

660
5
07-29-2022 12:16 AM
JayakumarPD
Occasional Contributor

we are using ArcGIS 10.8.

from client(browser) we have given an option to load the mxd (authored with colour and layer ordering) and related geodatabase.   Both database and mxd we are storing in server.  

Now we have to publish GP Service to open and show the mxd in browser. the bellow code we have converted into GP service

import arcpy, os
... parentDir = r"D:\DULT\2022\DultDBs"
... findfile = "LAMP2021.mxd"
... for (path, dirs, files) in os.walk(parentDir):
...     for file in files:
...         if file.lower().endswith(".mxd"):
...             mxd = arcpy.mapping.MapDocument(os.path.join(path, file))
...             str = mxd.filePath
...             if (str[21:]=findfile)
                  os.startfile(mxd)

  Now how to open/call this service from browser to show the mxd.  Can it be possible to render the mxd on browser.

  Is it a right way to address the issue or any alternate solution exist.  Kindly guide. 

 

0 Kudos
5 Replies
berniejconnors
Regular Contributor
Hello,

I think publishing your mxd as a map service will be simpler. A map service will maintain the colors and layer ordering and connection to your geodatabase.

Bernie.
0 Kudos
JayakumarPD
Occasional Contributor

Thank you sir,

But mxd's are not constant, they are plenty. We can not publish the mxd's as map service.

I need a geoprocessing service, which temporarily keeps the map service on user request from browser and get destroyed once user uncheck from browser.

is there any solution for this, or I am thinking in a wrong way.   

0 Kudos
TanuHoque
Esri Regular Contributor

@JayakumarPD 

GP services provide you an option to access results/output via its result map service. The output map and data should be unique for each job-id. I never tried this for the workflow you mentioned above. Please give that a try, in case you haven't done this already.

here is the help link: https://enterprise.arcgis.com/en/server/10.8/publish-services/windows/result-map-service.htm

0 Kudos
JayakumarPD
Occasional Contributor

If the mxd contains a voluminous data like 20-30 feature layer, then completion of job(i.e., publishing) will take much time. 

So client(browser) should wait till that time, and in web application we should increate the request-response round trip time!. 

I though it will affect the performance of the web application and user will quit from the browser.  

If the features are smaller, we can try, I think.

Thank you sir.

 

0 Kudos
TanuHoque
Esri Regular Contributor

@JayakumarPD 

Another option you can look at is what we call dynamicWorkspace option in dynamicLayers capability. That allows you to have a map service published with some bare minimum layers and then you can add new layers to the map service dynamically from some registered workspaces.

 

please see some docs here:

 

Dynamic layers' performance is on par with layers published with a map service.

0 Kudos