Select to view content in your preferred language

Add SQL Table, Convert to Shapefile and export to ArcGIS Server

2116
1
10-22-2014 10:59 AM
deleted-user-Pi5x1UjkS2PY
New Contributor II

I am very new to Python and very excited.  Moving from VBA.  The first mini project is to update my ArcGIS Server files.  I've heard you can do this with Python Scripting.  It would be great if I could automate this process.

Here is what I need to do:

Open up new project

Import a table from an SQL DB called "GISWEB.VW_MCYWEB" using an ODBC connection called "AR"

Make sure this file is webmercator because it is used in a JavaScript application

Convert this file to a shapefile called MCYWEB.shp

Then open up an MXD and Publish that MXD to the server.  The layers in the map are linked to the shapefile created earlier and already have symbology.

If possible have this run once a week.  

So is python this powerful?

0 Kudos
1 Reply
deleted-user-Pi5x1UjkS2PY
New Contributor II

So it seems that I can upload the mxd to the server using this so my last part is completed.  That is very cool

# create service definition draft

analysis = arcpy.mapping.CreateMapSDDraft(mapDoc, sddraft, service, 'ARCGIS_SERVER',

                                          con, True, folder, None, None)

Still need to import the SQL View, check the projection and save it as a shapefile.

0 Kudos