[mapguide-users] Re: How to create new/empty vector layer definition?
Hi Jackie, that solves the problem, doing this: string layerDefinition = @" http://www.w3.org/2001/XMLSchema-instance""; xmlns:xsd=""http://www.w3.org/2001/XMLSchema""; version=""2.3.0"" xsi:noNamespaceSchemaLocation=""LayerDefinition-2.3.0.xsd""> FeatureClass "; ILayerDefinition ldef = (ILayerDefinition)ResourceTypeRegistry.Deserialize(layerDefinition); But I 'd prefer this line instead :-) ILayerDefinition ldef = ObjectFactory.CreateDefaultLayer(con, LayerType.Vector); Thank you very much for your help. Best regards Hans Milling... -- View this message in context: http://osgeo-org.1560.n6.nabble.com/How-to-create-new-empty-vector-layer-definition-tp4465014p4471199.html Sent from the MapGuide Users mailing list archive at Nabble.com. ___ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users
[mapguide-users] Re: How to create new/empty vector layer definition?
Ok, I think the minimal object form created by ObjectFactory is invalid. I'll have to take a look at that because any object you create from ObjectFactory should satisfy the minimum XML content model requirements of its respective XML schema. What about creating a fresh >= 2.3.0 layer definition in Maestro, snip its XML and using ResourceTypeRegistry to create a Layer Definition object from this XML snippet? Does that work for you? - Jackie -- View this message in context: http://osgeo-org.1560.n6.nabble.com/How-to-create-new-empty-vector-layer-definition-tp4465014p4471167.html Sent from the MapGuide Users mailing list archive at Nabble.com. ___ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users
[mapguide-users] Re: How to create new/empty vector layer definition?
Just to be sure, this is the code that I am using: ILayerDefinition ldef = ObjectFactory.CreateDefaultLayer(con, LayerType.Vector); string resId = new ResourceIdentifier(Guid.NewGuid().ToString(), ResourceTypes.LayerDefinition, con.SessionID); con.ResourceService.SaveResourceAs(ldef, resId); con is of course an IServerConnection and by http. Hans... -- View this message in context: http://osgeo-org.1560.n6.nabble.com/How-to-create-new-empty-vector-layer-definition-tp4465014p4467973.html Sent from the MapGuide Users mailing list archive at Nabble.com. ___ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users
[mapguide-users] Re: How to create new/empty vector layer definition?
Hi Jackie I now then get the following exception when saving the new layerdefinition (SaveResourceAs): The remote server returned an error: (559) MgDbXmlException.: An exception occurred in DB XML component. Error: Error: XML Indexer: Parse error in document at line 74, char 27. Parser message: element 'Watermarks' is not allowed for content model '(ResourceId,Opacity?,Watermarks?,FeatureName,FeatureNameType,Filter?,PropertyMapping*,Geometry,Url?,ToolTip?,VectorScaleRange+,ExtendedData1?)' (Document: Session:f4096d7a-56e5-11e1-8000-08002700eca5_en_7F010B060B050B04//1b636238-f0f5-443b-852a-554d04d012ce.LayerDefinition) I am using AIMS2012. I remember you previously changed some code to support the AIMS2012 'watermarks' tag. I guess this also requires some modification? Do you want me to create a ticket? Best regards Hans Milling... -- View this message in context: http://osgeo-org.1560.n6.nabble.com/How-to-create-new-empty-vector-layer-definition-tp4465014p4467919.html Sent from the MapGuide Users mailing list archive at Nabble.com. ___ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users
[mapguide-users] Re: How to create new/empty vector layer definition?
Use the ObjectFactory for creating resource objects from scratch. Use the ResourceTypeRegistry for creating resource objects from XML strings. http://themapguyde.blogspot.com.au/2011/08/maestro-api-3-ways-to-create-and-work.html - Jackie -- View this message in context: http://osgeo-org.1560.n6.nabble.com/How-to-create-new-empty-vector-layer-definition-tp4465014p4465333.html Sent from the MapGuide Users mailing list archive at Nabble.com. ___ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users