[mapguide-users] Resource data was not found
Cory Gregor
cgregor at barkerlemar.com
Wed Oct 11 14:06:58 EDT 2006
Is there something in Studio that i need to do to make the resources part of
the maps work?
Thanks,
Cory
François VANDER BIEST wrote:
>
> You might find a solution to your problem here :
> http://www.nabble.com/How-to-check-if-session-is-expired--tf2218864.html#a6549987
>
> It took me a lot of time to find this trick.
>
> F.
>
> Cory Gregor a écrit :
>> The code is blowing up on this line: map.Open(ResourceService,
>> mgResourceID);
>> The browser is telling me " Resource datawas not found:
>> RuntimeDataResource
>> data was not found: ....."
>>
>> Is the some IIS config problem maybe? IIS 6 on Win2k3 Server.
>>
>> Here is the code...
>>
>> //String mapDefinition =
>> "Library://Samples/FredWeber/Maps/Default.MapDefinition";
>> //String webLayout =
>> "Library://Samples/FredWeber/FredWeber.WebLayout";
>> String sessionId = "";
>> String NoLayers = "No Layers Selected";
>>
>> try
>> {
>> MapGuideApi.InitializeSockets();
>> InitializeWebTier();
>>
>> MgUserInformation userInfo = new
>> MgUserInformation("XXXX","YYYY");
>> MgSite site = new MgSite();
>>
>> site.Open(userInfo);
>>
>> sessionId = site.CreateSession();
>>
>> MgSiteConnection siteConnection = new MgSiteConnection();
>> siteConnection.Open(userInfo);
>>
>> MgResourceService ResourceService =
>> siteConnection.CreateService(MgServiceType.ResourceService) as
>> MgResourceService;
>> MgFeatureService FeatureService =
>> siteConnection.CreateService(MgServiceType.FeatureService) as
>> MgFeatureService;
>> MgFeatureQueryOptions QueryOptions = new MgFeatureQueryOptions();
>>
>> MgResourceIdentifier mgResourceID = new
>> MgResourceIdentifier(mapDefinition);
>>
>> MgMap map = new MgMap();
>>
>> map.Open(ResourceService, mgResourceID);
>> Response.Write("Got here");
>> MgSelection selection = new MgSelection(map);
>>
>> selection.Open(ResourceService, "map");
>>
>> MgReadOnlyLayerCollection Layers = selection.GetLayers();
>>
>> if (Layers.GetCount() > 0)
>> {
>> for (int i = 0; i < Layers.GetCount(); i++)
>> {
>>
>> //Only check selected features in the Parcels layer.
>>
>> MgLayer Layer = Layers.GetItem(i);
>>
>> if (Layer != null && Layer.GetLayerDefinition() == new
>> MgResourceIdentifier("Default_Map Base_727(3)"))
>> {
>> //Create a filter containing the IDs of the selected
>> //features on this layer
>>
>> string LayerClassName = Layer.GetFeatureClassName();
>> string selectionString =
>> selection.GenerateFilter(Layer,
>> LayerClassName);
>>
>> //Get the feature resource for the selected layer
>>
>> string LayerFeatureId = Layer.GetFeatureSourceId();
>> MgResourceIdentifier LayerFeatureResource = new
>> MgResourceIdentifier(LayerFeatureId);
>>
>> //Apply the filter to the feature resource for the
>> // selected layer. This returns
>>
>>
>> //an MgFeatureReader of all the selected features.
>>
>> QueryOptions.SetFilter(selectionString);
>>
>> MgFeatureReader FeatureReader =
>> FeatureService.SelectFeatures(LayerFeatureResource, LayerClassName,
>> QueryOptions);
>>
>> //Process each item in the MgFeatureReader,
>> displaying
>> the
>> //owner name and address
>>
>> while (FeatureReader.ReadNext())
>> {
>>
>> string val =
>> FeatureReader.GetString("FeatureID");
>>
>> //FeatureReader.GetString("Layer");
>>
>> Response.Write(val);
>>
>> }
>>
>> }
>>
>> }
>>
>> }
>>
>> else
>> {
>> Response.Write(NoLayers);
>> }
>>
>>
>> MapGuideApi.TerminateSockets();
>> }
>> catch (MgException mge)
>> {
>> Response.Write(mge.GetMessage());
>> Response.Write(mge.GetDetails());
>> MapGuideApi.TerminateSockets();
>> }
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe at mapguide.osgeo.org
> For additional commands, e-mail: users-help at mapguide.osgeo.org
>
>
>
--
View this message in context: http://www.nabble.com/Resource-data-was-not-found-tf2419141.html#a6761638
Sent from the OSGeo MapGuide mailing list archive at Nabble.com.
More information about the Mapguide-users
mailing list