[mapguide-users] DWGLoadProcedure

Kenneth Skovhede, GEOGRAF A/S ks at geograf.dk
Fri Oct 17 03:00:23 EDT 2008


As DWG is a proprietary format, I belive it will be difficult to do this 
with only open-source software.
Supposedly, you can use FME to do it, and I think there is some 
organisation that has a 'open-source' like library for reading DWG data.

There are no methods for dealing with DWG in Maestro or the Maestro API, 
for the above reasons.

As for SHP, it is fairly easy to do this:
IServerConnection con = new HttpServerConnection(url, username, 
password, locale, false);
FeatureSource fs = new FeatureSource();
fs.Provider = "OSGeo.SHP.3.3"; //Adjust if you are not using FDO 3.3
fs.Parameter = new NameValueCollection();
fs.Parameter["DefaultFileLocation"] = 
"%MG_DATA_FILE_PATH%ShapeFile.SHP"; //Can use absolute path here
string resId = "Library://MyShpFile.FeatureSource";
con.SaveResourceAs(fs, resId);
using(System.IO.FileStream fs = 
System.IO.File.OpenRead("C:\\myshapefile.shp"))
    con.SetResourceData(resId, "ShapeFile.SHP", ResourceDataType.File, fs);

The above code will create a managed copy of your shape data.
If you want an unmanaged copy, just change "DefaultFileLocation" to the 
absolute path, and remove the "SetResourceData" call.

Regards, Kenneth Skovhede, GEOGRAF A/S



Greenhough, Jamie skrev:
>
> Hello again MapGuide coders ;)
>
>  
>
> I want to programmatically load .dwg/.shp files to a managed MapGuide 
> environment.
>
>  
>
> I think this can be accomplished with the MapGuide Studio API... but 
> are there any other ways to get this data into the MapGuide server? 
> I'm trying to stay open source. Are there any methods in the Maestro 
> API to accomplish this?
>
> ----Notice Regarding Confidentiality----
> This email, including any and all attachments, (this "Email") is 
> intended only for the party to whom it is addressed and may contain 
> information that is confidential or privileged. Sierra Systems Group 
> Inc. and its affiliates accept no responsibility for any loss or 
> damage suffered by any person resulting from any unauthorized use of 
> or reliance upon this Email. If you are not the intended recipient, 
> you are hereby notified that any dissemination, copying or other use 
> of this Email is prohibited. Please notify us of the error in 
> communication by return email and destroy all copies of this Email. 
> Thank you.
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20081017/48633c6f/attachment.html


More information about the mapguide-users mailing list