[mapguide-users] Load Procedures via a script examples?

Bill Dhimitri bill.dhimitri at autodesk.com
Wed Aug 9 16:07:22 EDT 2006


Scott,

I think you are asking about using the MG Studio API that allows you to
programmatically load an SDF, SHP, DWF, or raster file directly to a MG
server.

I have pasted some code below to show a simple example of how to use
this API.  Just to clarify, the Studio API allows you to create a
package (.mgp) file (via the PackageWriter class).  That's not what I am
talking about.  I am talking about classes like SdfLoadProcedure and
ShpLoadProcedure.  These classes do not create .mgp files.  Instead,
they provide a programmatic way to do what the MG Studio Load Procedure
UI's let's you do.

Note that if you use the Studio API, you must place your .exe file into
the MG Studio installation folder and run it from there.  Otherwise,
your .exe file will not be able to load/run the necessary DLLs, and you
will get an error message at run time stating that a module/file could
not be found.

Bill

        using Autodesk.MapGuide.Studio.Load;
        using Autodesk.MapGuide.Studio.Site;

        void Test()
        {
            LoadSdfFile("C:\\parcels.sdf");
        }

        void LoadSdfFile(string sdfFilePath)
        {
            SiteManager siteManager = SiteManager.GetInstance();
            ConnectionStatus connStatus;
            SiteConnection siteConn = siteManager.CreateConnection(
                "http://localhost/mapguide",
                "Author", "author", out connStatus);
            if (connStatus != ConnectionStatus.Success)
                return;

            SdfLoadProcedure sdfLoading = new SdfLoadProcedure();
            sdfLoading.SourceFiles.Add(sdfFilePath);
            sdfLoading.RootPath = "Library://Test";
            sdfLoading.Execute(siteConn);
        }

 

-----Original Message-----
From: Jason Birch [mailto:Jason.Birch at nanaimo.ca] 
Sent: Wednesday, August 09, 2006 1:05 PM
To: users at mapguide.osgeo.org
Subject: RE: [mapguide-users] Load Procedures via a script examples?

Hi Scott,

I'm not entirely sure what you're asking.

I put up a couple sample scripts for making packages from existing
server-side resources, and loading the same.  Is that what you're
looking for?  

http://tinyurl.com/qesur

I don't think that anyone has figured out how to build packages
externally to Autodesk MapGuide Studio yet.

My current plan is to load the initial packages through Studio, and then
use FME (there is SDF support in 2006GB) to refresh the data source
directly in the repository.

Jason

-----Original Message-----
From: Scott Reisdorf [mailto:reisdorf1 at llnl.gov] 
Sent: Wednesday, August 09, 2006 09:33
To: users at mapguide.osgeo.org
Subject: [mapguide-users] Load Procedures via a script examples?

Does anyone have examples of executing a Load Procedure (i.e. loading
data from an XML file) via a script?
I cant seem to find any examples in the Dev Guide on how to do this.  
Any sample code would be of assistance.
Thanks,

-scott

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe at mapguide.osgeo.org
For additional commands, e-mail: users-help at mapguide.osgeo.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe at mapguide.osgeo.org
For additional commands, e-mail: users-help at mapguide.osgeo.org






More information about the Mapguide-users mailing list