Re: [mapguide-users] Change Raster Layer ResourceSourceId

2016-04-06 Thread Jackie Ng
The Maestro API has some configuration document classes that you might be
able to use.

But however, configuration documents are provided specific and the Maestro
API only supports configuration documents for a small subset of the FDO
providers (ODBC, GDAL, WMS). Anything else, you'll have to resort to generic
XML document manipulation.

- Jackie



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Change-Raster-Layer-ResourceSourceId-tp5259045p5260049.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

Re: [mapguide-users] Change Raster Layer ResourceSourceId

2016-04-06 Thread Liglio
Hi,

I found what was missing. The configuration file "config.xml" must be
provided to the temporary raster feature source using SetResourceData. I can
use the config.xml file generated by Studio and change to point to the
choosen file, and change other parameters also. But can I generate this
config.xml file progamatically using some mapguide functions, or FDO
functions ?

Thanks



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Change-Raster-Layer-ResourceSourceId-tp5259045p5260040.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] Change Raster Layer ResourceSourceId

2016-03-31 Thread Liglio
Hi,

I am trying to change dinamically the raster image of a layer, following the
steps:
1 - Copy the xml content of the original Resource Source and change the
raster file path.
2 - Create a Session Resource Source with the above modified xml content.
3 - Copy the xml content of the original Layer and change the ResourceId
pointing to the above created Session Resource Source.
4 - Create a Session Layer with the above modified xml contente.
5 - Save the changes to the map session.

I used this steps to do the same to shape layers and worked, but to raster
layers. I am using c# and mapguide 2.5.2. Here is the code: (Thanks for any
help)

strFeatureSourceId = layer.GetFeatureSourceId();

//Read the feature source content 
resIdFeat = new MgResourceIdentifier(strFeatureSourceId);
if (resourceService.ResourceExists(resIdFeat))
{
strXml = (resourceService.GetResourceContent(resIdFeat)).ToString();
}

//Manipulate xml, set the Tags Filter
strXml = Util.SetTagTextContent(strXml, "/FeatureSource/Parameter/Value",
strFileName, true);

//Create temporary feature source resource
strFeatureSourceName =
strFeatureSourceId.Substring(strFeatureSourceId.LastIndexOf("/") + 1);
strFeatureSourceIdForSession = "Session:" + strSessionMap + "//" +
strFeatureSourceName;
resIdFeat = new MgResourceIdentifier(strFeatureSourceIdForSession);

//Write the featrure source content
encoding = new System.Text.ASCIIEncoding();
ByteSource = new MgByteSource(encoding.GetBytes(strXml), strXml.Length);
resourceService.SetResource(resIdFeat, ByteSource.GetReader(), null);

//Read the layer resource 
resIdLayer = layer.GetLayerDefinition();
if (resourceService.ResourceExists(resIdFeat))
{
strXml = (resourceService.GetResourceContent(resIdLayer)).ToString();
}

//Manipulate xml, set the Tags Filter
strXml = Util.SetTagTextContent(strXml,
"/LayerDefinition/GridLayerDefinition/ResourceId",
strFeatureSourceIdForSession);

//Create temporary layer resource
strLayerIdForsession = "Session:" + strSessionMap + "//" + strLayerName +
"." + MgResourceType.LayerDefinition;
resIdLayer = new MgResourceIdentifier(strLayerIdForsession);

//Write the layer content
encoding = new System.Text.ASCIIEncoding();
ByteSource = new MgByteSource(encoding.GetBytes(strXml), strXml.Length);
resourceService.SetResource(resIdLayer, ByteSource.GetReader(), null);

//Get the temp layer
layerTemp = GetLayerByName(map, strLayerNameForSession);
layerTemp.ForceRefresh();
map.Save(resourceService);



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Change-Raster-Layer-ResourceSourceId-tp5259045.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