To convert data to SDF, you must use the FDO libraries.
I think the FDO toolbox can do this for you, and if not, it's open
source, so you can use it as a starting point:
http://code.google.com/p/fdotoolbox
By "Set the coordinate system", do you mean coordinate system override?
If so, you can look at how Maestro does this:
http://trac.osgeo.org/mapguide/browser/trunk/Tools/Maestro/Maestro/ResourceEditors/CoordinateSystemOverride.cs#L256
I'm not quite sure how SHP files work, but I think you have to add the
.dbf to the featuresource as well,
ea. add these lines:
using (System.IO.FileStream fss =
System.IO.File.OpenRead("C:\\Hydrant.dbf"))
con.SetResourceData(resId, "ShapeFile.DBF", ResourceDataType.File, fss);
And the SHP provider should pick it up. Repeat for any extra files you
want (ea. index files, etc.)
Regards, Kenneth Skovhede, GEOGRAF A/S
Greenhough, Jamie skrev:
Thanks Kenneth(!!),
I've implemented your code snippet, and it now looks like this:
string username = "Author1";
string password = "Author1";
string locale = "EN";
string url = "http://mapguideserver/MapGuide";
System.Uri uri = new System.Uri(url);
ServerConnectionI con = new HttpServerConnection(uri, username,
password, locale, false);
FeatureSource fs = new FeatureSource();
fs.Provider = "OSGeo.SHP.3.3";
fs.Parameter = new NameValuePairTypeCollection();
fs.Parameter["DefaultFileLocation"] =
"%MG_DATA_FILE_PATH%ShapeFile.SHP";
string resId = "Library://MYNEWTESTSHAPE.FeatureSource";
con.SaveResourceAs(fs, resId);
using (System.IO.FileStream fss =
System.IO.File.OpenRead("C:\\Hydrant.shp"))
con.SetResourceData(resId, "ShapeFile.SHP",
ResourceDataType.File, fss);
... and that works.
Now I'm looking at and thinking about how to:
o *Convert to SDF feature source.*
o *Set the coordinate system.*
o *Import/save the attribute data from *.dbf file.*
So I'm looking for more direction/information on uploading shp files
to a managed mapguide server. Anyone?
Thanks
*From:* [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] *On Behalf Of *Kenneth
Skovhede, GEOGRAF A/S
*Sent:* Friday, October 17, 2008 1:00 AM
*To:* MapGuide Users Mail List
*Subject:* Re: [mapguide-users] DWGLoadProcedure
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
[email protected] <mailto:[email protected]>
http://lists.osgeo.org/mailman/listinfo/mapguide-users
----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
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapguide-users
_______________________________________________
mapguide-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapguide-users