Creation of a FeatureSource

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Creation of a FeatureSource

jerome.duckers
Hi,
 
I have a problem to create a FeatureSource with the MgResourceService
 
My Code is very simple:
 
string xml =  DynamicLayer.GetTemplate("MgData_test.templ");
 
MgResourceIdentifier dataId = DynamicLayer.SaveSessionResource("test.FeatureSource", xml, sessionId, resourceSrvc);
xml = DynamicLayer.GetTemplate("MgLayer_test.templ");
MgResourceIdentifier layerId = DynamicLayer.SaveSessionResource("test.LayerDefinition", xml, sessionId, resourceSrvc);
new
MgLayer(layerId, resourceSrvc);
...
map.Save(resourceSrvc, mapStateId);
the function SaveSessionResource is:
public
static MgResourceIdentifier SaveSessionResource(string name, string content, string sessionId, MgResourceService resourceService)
{
string resourceId = string.Format("Session:{0}//{1}" ,sessionId, name);
var mgResourceIdentifier = new MgResourceIdentifier(resourceId);
resourceService.SetResource(mgResourceIdentifier,
new MgByteReader(content, "text/xml"), null);
return mgResourceIdentifier;
}
 


The Layer appears in my legend, everything is correct, but nothing appears on the map.
I thing that the featureSource is not created ! I miss something ?
I try to create in Maestro a Layer based on my FeatureSource, but nothing appears.
The featureSource is based on a SDF, that is not empty.
 
 
Thanks a lot.
Best Regards.
Jérôme.
Reply | Threaded
Open this post in threaded view
|

Re: Creation of a FeatureSource

GordonL
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Creation of a FeatureSource

jerome.duckers
Hi Gordon,
 
Thanks
 
You have right. If i change to Library => the data is correctly created in Maestro, and everything is good.
The Layer is drawing.
 
 
I see that in my layerTemplate, it was :
       <ResourceId>Library://{0}.FeatureSource</ResourceId>
 
I think that's the reason why i did'nt see the draw in my map.
So, i try to replace the
               <ResourceId>Library://{0}.FeatureSource</ResourceId>
         by
              <ResourceId>Session:{0}//{1}.FeatureSource</ResourceId>        // where {0} is the sessionId
                                                                                                                         {1} the name
 
but nothing on screen :(
 
I am always searching.


 
2012/9/10 GordonL [via OSGeo.org] <[hidden email]>
I  tend to create permanent Library connections and layers when debugging, so i can debug them in Maestro.

change your lines where you have 'Session' to Library

 string resourceId = string.Format("Session:{0}//{ 1}" ,sessionId, name);

 string resourceId = string.Format("Library://{0}", name);

for example.




If you reply to this email, your message will be added to the discussion below:
http://osgeo-org.1560.n6.nabble.com/Creation-of-a-FeatureSource-tp5000822p5000824.html
To unsubscribe from Creation of a FeatureSource, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: Creation of a FeatureSource

jerome.duckers
I'v founded my mistake, it was an error on the name.
 
Thanks for your help Gordon.
 
Best Regards
Jérôme.


 
2012/9/10 jerome.duckers <[hidden email]>
Hi Gordon,
 
Thanks
 
You have right. If i change to Library => the data is correctly created in Maestro, and everything is good.
The Layer is drawing.
 
 
I see that in my layerTemplate, it was :
       <ResourceId>Library://{0}.FeatureSource</ResourceId>
 
I think that's the reason why i did'nt see the draw in my map.
So, i try to replace the
               <ResourceId>Library://{0}.FeatureSource</ResourceId>
         by
              <ResourceId>Session:{0}//{1}.FeatureSource</ResourceId>        // where {0} is the sessionId
                                                                                                                         {1} the name
 
but nothing on screen :(
 
I am always searching.


 
2012/9/10 GordonL [via OSGeo.org] <[hidden email]>

I  tend to create permanent Library connections and layers when debugging, so i can debug them in Maestro.

change your lines where you have 'Session' to Library

 string resourceId = string.Format("Session:{0}//{ 1}" ,sessionId, name);

 string resourceId = string.Format("Library://{0}", name);

for example.




If you reply to this email, your message will be added to the discussion below:
http://osgeo-org.1560.n6.nabble.com/Creation-of-a-FeatureSource-tp5000822p5000824.html
To unsubscribe from Creation of a FeatureSource, click here.
NAML



View this message in context: Re: Creation of a FeatureSource
Sent from the MapGuide Users mailing list archive at Nabble.com.

_______________________________________________
mapguide-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapguide-users



_______________________________________________
mapguide-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapguide-users