This page is one of the MapGuide Community CodeSamples. Visit the CodeSamples page to view more!
This is a simple script to update all your layers featuresource from one to another (e.g. : all your layers feature source from dev environnement to production environnement) . It only change the source, you have to use the same schema in your environnements. It check if the layer featuresource match "oldF" then replace it with "newF"
How to use this script
- Launch MapGuide Maestro
- In the IronPython console, click Run File
- Browse to replace_connection_utils.py and click Open to load this script
Once loaded, you will have the following functions available for you to use from the IronPython console:
def UpdateLayersFeatureSchema(conn, folder, oldSchema, newSchema): """ Modifies the featuresource of layerdefinition matching the old featureschema name """ def UpdateLayersFeatureSource(conn, folder, oldF, newF): """ Modifies the featuresource of layerdefinition matching the old featuresource name """
Usage
conn = app.GetConnection('http://yourserver/mapserver2012 (v2.3.0.4202)') UpdateLayersFeatureSource(conn,'Library://map/Layers/','Library://map/data/cnx_DEV.FeatureSource','Library://map/cnx_PROD.FeatureSource')
Last modified
11 years ago
Last modified on 04/04/14 02:29:46
Attachments (1)
- replace_connection_utils.py (1.9 KB ) - added by 11 years ago.
Download all attachments as: .zip
Note:
See TracWiki
for help on using the wiki.