[mapguide-users] Creating Packages dynamically

Kenneth Skovhede, GEOGRAF A/S ks at geograf.dk
Fri Jan 30 04:05:43 EST 2009


Steps required to create a FeatureSource:

MaestroAPI.HttpServerConnection con = new 
OSGeo.MapGuide.MaestroAPI.HttpServerConnection(new 
Uri("http://localhost/mapguide"), "Administrator", "admin", null, true);
MaestroAPI.FeatureSource featureSource = 
con.CreateResourceObject<MaestroAPI.FeatureSource>();
.... set properties on the featureSource object as you like.....          
.... there is no manual for this, look at an existing featuresource's 
xml for hints ...
con.SaveResourceAs(featureSource, 
"Library://myfeaturesource.FeatureSource");

Steps required to create a LayerDefinition:
MaestroAPI.HttpServerConnection con = new 
OSGeo.MapGuide.MaestroAPI.HttpServerConnection(new 
Uri("http://localhost/mapguide"), "Administrator", "admin", null, true);
MaestroAPI.LayerDefinition layerDefinition = 
con.CreateResourceObject<MaestroAPI.LayerDefinition>();
MaestroAPI.VectorLayerDefinitionType vldef = layerDefinition.Item as 
MaestroAPI.VectorLayerDefinitionType;
.... set properties on the vldef object as you like.....          
.... there is no manual for this, look at an existing layerdefinition's 
xml for hints ...
//Attach to featureSource
vldef.ResourceId = featureSource.ResourceId;
vldef.FeatureName = "Schema:Class"; //Needs to change according to 
featuresource

con.SaveResourceAs(layerDefinition, "Library://mylayer.LayerDefinition");

If you prefer not to use the MaestroAPI, you can do the same using raw 
xml, but you need to know what xml tags are valid where.


Regards, Kenneth Skovhede, GEOGRAF A/S



padmini godavarthi skrev:
> Hi Kenneth,
> thanks for u r help.
> Actually i want a help 
>
> u told that 
>
> "Restoring a package is quite a big and cumbersome task.
> If you want to load a layer with oracle data, it is much easier to do so,
> simply by loading the Xml manually. This can also be done without 
> Administrator credentials.
>
> I can offer you no more advice than to look at the avalible code.
> AFAIK, there is no example code avalible that does exactly what you
> want, but the code I pointed you to should make it easier to do so."
>
> can u plz tell me the step by step procedure exactly for creating feature
> rsource,layers  
> so that it will be helpful to me for loading oracle data (approximately 10
> layers)
> plz consider this request.
>
> Thanks and Regards,
> Padmini
>
>
>
> Kenneth Skovhede, GEOGRAF A/S wrote:
>   
>> 0) Seriously, scroll down to the initial response in the mail for a link 
>> to the code.
>>
>> 1) You recently posted about the LayerDefinitionFactory, so
>> surely you know how to load xml.
>>
>> Regards, Kenneth Skovhede, GEOGRAF A/S
>>
>>
>>
>> padmini godavarthi skrev:
>>     
>>> Hi Kenneth,
>>> Thanks for u r reply.
>>> u told for seeing available code.
>>> but where is that code i didn't get it.
>>>
>>> 1)how to load xml manually 
>>>
>>> can u give me an idea so that it will be helpful to me.
>>>
>>>
>>>
>>> Thanks and Regards,
>>> Padmini
>>>
>>> Kenneth Skovhede, GEOGRAF A/S wrote:
>>>   
>>>       
>>>> Restoring a package is quite a big and cumbersome task.
>>>> If you want to load a layer with oracle data, it is much easier to do
>>>> so,
>>>> simply by loading the Xml manually. This can also be done without
>>>> Administrator credentials.
>>>>
>>>> I can offer you no more advice than to look at the avalible code.
>>>> AFAIK, there is no example code avalible that does exactly what you
>>>> want, but the code I pointed you to should make it easier to do so.
>>>>
>>>> Regards, Kenneth Skovhede, GEOGRAF A/S
>>>>
>>>>
>>>>
>>>> padmini godavarthi skrev:
>>>>     
>>>>         
>>>>> Hi Kenneth,
>>>>> Thanks for u r reply.
>>>>>
>>>>> u said that "Creating packages is an administrative task, so I won't
>>>>> expect
>>>>> many API 
>>>>>  users to have a need for it".but i want to load layers from oracle
>>>>> dynamically 
>>>>>
>>>>> (i mean to say if i have a,b,c tables in oracle.i ant to load a,b or
>>>>> b,c
>>>>> or
>>>>> a,c layers based on requirement programmetically.so i thought dynamic
>>>>> maestro will support this requirement.)
>>>>>
>>>>> can u plz tell me 
>>>>>
>>>>> 1) How can i achieve this requirement dynamically.
>>>>>
>>>>>
>>>>>
>>>>> Thanks and Regards,
>>>>> Padmini.
>>>>>
>>>>>
>>>>>
>>>>> Rodolfo Moreno wrote:
>>>>>   
>>>>>       
>>>>>           
>>>>>> thanks Kenneth, It's cool.
>>>>>>
>>>>>>
>>>>>> Kenneth Skovhede, GEOGRAF A/S wrote:
>>>>>>     
>>>>>>         
>>>>>>             
>>>>>>> Yes, you need at least 1.0.9, but the released version has a bug,
>>>>>>> with creating packages, so you should get the preview release from
>>>>>>> the 
>>>>>>> download page:
>>>>>>> http://trac.osgeo.org/mapguide/wiki/maestro/Downloads
>>>>>>>
>>>>>>> The package options are found in the "Package" menu.
>>>>>>>
>>>>>>> Regards, Kenneth Skovhede, GEOGRAF A/S
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Rodolfo Moreno skrev:
>>>>>>>       
>>>>>>>           
>>>>>>>               
>>>>>>>> Hi, I didn't know that Mapguide Maestro can create mapguide
>>>>>>>> packages.
>>>>>>>> I have 1.0.8.27399 version and I have not found this option.
>>>>>>>> could you tell me how can I achieve this?
>>>>>>>> or maybe I need the last maestro version.
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>>
>>>>>>>>
>>>>>>>> Kenneth Skovhede, GEOGRAF A/S wrote:
>>>>>>>>   
>>>>>>>>         
>>>>>>>>             
>>>>>>>>                 
>>>>>>>>> Hello Padmini.
>>>>>>>>>
>>>>>>>>> There are no ready-to-use code in MaestroAPI for authoring
>>>>>>>>> (creating) 
>>>>>>>>> MapGuide Packages.
>>>>>>>>> Creating packages is an administrative task, so I won't expect many
>>>>>>>>> API 
>>>>>>>>> users to have a need for it.
>>>>>>>>>
>>>>>>>>> The Maestro application has code that creates and edits packages.
>>>>>>>>> The code can be found here:
>>>>>>>>> http://trac.osgeo.org/mapguide/browser/trunk/Tools/Maestro/Maestro/PackageManager
>>>>>>>>>
>>>>>>>>> Especially the file "PackageBuilder.cs" should be of interrest.
>>>>>>>>>
>>>>>>>>> Regards, Kenneth Skovhede, GEOGRAF A/S
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> padmini godavarthi skrev:
>>>>>>>>>     
>>>>>>>>>           
>>>>>>>>>               
>>>>>>>>>                   
>>>>>>>>>> Hi,
>>>>>>>>>> iam using mapguide opensource 2.0 (with .net 2.0+IIS 5.1)
>>>>>>>>>> Presently iam using mapguide maestro for creating  mapguide
>>>>>>>>>> packages.but
>>>>>>>>>> i
>>>>>>>>>> want to create my package dynamically through coding(using
>>>>>>>>>> maestroAPI.dll)
>>>>>>>>>>
>>>>>>>>>> can any boby plz help me so that it will be very helpful to me.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Regards,
>>>>>>>>>> Padmini.  
>>>>>>>>>>   
>>>>>>>>>>       
>>>>>>>>>>             
>>>>>>>>>>                 
>>>>>>>>>>                     
>>>>>>>>> _______________________________________________
>>>>>>>>> mapguide-users mailing list
>>>>>>>>> mapguide-users at lists.osgeo.org
>>>>>>>>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>     
>>>>>>>>>           
>>>>>>>>>               
>>>>>>>>>                   
>>>>>>>> -----
>>>>>>>> Rodolfo Moreno
>>>>>>>> CivilEng
>>>>>>>>
>>>>>>>>   
>>>>>>>>         
>>>>>>>>             
>>>>>>>>                 
>>>>>>> _______________________________________________
>>>>>>> mapguide-users mailing list
>>>>>>> mapguide-users at lists.osgeo.org
>>>>>>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>>>>>>>
>>>>>>>
>>>>>>>       
>>>>>>>           
>>>>>>>               
>>>>>>     
>>>>>>         
>>>>>>             
>>>>>   
>>>>>       
>>>>>           
>>>> _______________________________________________
>>>> mapguide-users mailing list
>>>> mapguide-users at lists.osgeo.org
>>>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>>>>
>>>>
>>>>     
>>>>         
>>>   
>>>       
>> _______________________________________________
>> 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/20090130/2eda6a32/attachment.html


More information about the mapguide-users mailing list