[mapguide-users] can maestro create sdf?

Hans Milling hm at geograf.dk
Fri Dec 13 00:23:43 PST 2013


How about this (Using LocalNative):
// Initial setup
MgSiteConnection con = new MgSiteConnection();
MgUserInformation mguserinfo = new MgUserInformation(sessionID); //
HTTPConnection session ID
con.Open(mguserinfo);
MgFeatureService featureService =
con.CreateService(MgServiceType.FeatureService) as MgFeatureService;
MgClassDefinition addressClass = new MgClassDefinition();
addressClass.SetName("MyMarkers");
MgPropertyDefinitionCollection properties = addressClass.GetProperties();
// ID Property
MgDataPropertyDefinition idProperty = new MgDataPropertyDefinition("id");
idProperty.SetDataType(MgPropertyType.Int32);
idProperty.SetReadOnly(true);
idProperty.SetNullable(false);
idProperty.SetAutoGeneration(true);
properties.Add(idProperty);
// String Property
MgDataPropertyDefinition prop = new MgDataPropertyDefinition("name");
prop.SetDataType(MgPropertyType.String);
prop.SetLength(512);
properties.Add(prop);
// Add geometry column
MgGeometricPropertyDefinition gprop = new
MgGeometricPropertyDefinition("latlng");
gprop.SetGeometryTypes(MgGeometryType.Point);
gprop.SetHasElevation(false);
gprop.SetHasMeasure(false);
gprop.SetReadOnly(false);
gprop.SetSpatialContextAssociation(projection);
properties.Add(gprop);
MgPropertyDefinitionCollection idProperties =
addressClass.GetIdentityProperties();
idProperties.Add(idProperty);
addressClass.SetDefaultGeometryPropertyName("latlng");
MgFeatureSchema addressSchema = new MgFeatureSchema();
addressSchema.SetName("Marker");
addressSchema.GetClasses().Add(addressClass);
string coordCode =
con.CoordinateSystemCatalog.ConvertWktToCoordinateSystemCode(map.CoordinateSystem);
MgCreateSdfParams sdfParams = new MgCreateSdfParams(coordCode,
map.CoordinateSystem, addressSchema);
featureService.CreateFeatureSource(new MgResourceIdentifier(resid),
sdfParams);

Best regards Hans Milling...



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/can-maestro-create-sdf-tp5094043p5094112.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list