Web API Reference | MapGuide Open Source |
Adds resource data to the specified resource.
.NET Syntax
Java Syntax
PHP Syntax
Examples (PHP)
This example sets resource data and stores it as a file: // Assuming that $resourceService has already been initialized // Assuming that 'Library://Geography/Calgary points of interest.FeatureSource' has already been added to the repository $resourceID = new MgResourceIdentifier('Library://Geography/Calgary points of interest.FeatureSource'); $byteSource = new MgByteSource('C:\Data\Calgary\Data\Calgary_points.sdf'); $data = $byteSource->GetReader(); $resourceService->SetResourceData($resourceID, 'locations of points of interest', 'File', $data); This example sets resource data and stores it as a stream: // Assuming that 'Library://Geography/Calgary symbols.SymbolSet' has already been added to the repository $resourceID = new MgResourceIdentifier('Library://Geography/Trees.SymbolLibrary'); $byteSource = new MgByteSource('C:\Data\Calgary\Data\markers.dwf'); $data = $byteSource->GetReader(); $resourceService->SetResourceData($resourceID, 'symbols for points of interest', 'Stream', $data); This example sets the embedded credentials for a resource and stores it as a string. The string data type must be used for embedded credentials. The data name must be MgResourceDataName::UserCredentials. // Assuming that 'Library://Geography/database connnection.FeatureSource' has already been added to the repository $resourceID = new MgResourceIdentifier('Library://Geography/database connnection.FeatureSource'); $byteSource = new MgByteSource('C:\Data\Calgary\Data\credentials.txt'); $data = $byteSource->GetReader(); $dataName = new MgResourceDataName(); $resourceService->SetResourceData($resourceID, MgResourceDataName::UserCredentials, 'String', $data);
|