Making Changes Permanent

So far, all the examples in this chapter have only affected the user’s runtime version of the map. No other users see those changes, and when the current user logs out those changes will be lost.

To make changes permanent, the script can save the modified layer back into the Library.

    $byteSource = new MgByteSource($layerDefinition, strlen($layerDefinition));

    $byteSource->SetMimeType(MgMimeType::Xml);

    $resourceId =

      new MgResourceIdentifier("Library://LayerName.LayerDefinition");

    $resourceService->SetResource(

      $resourceId, $byteSource->GetReader(), null);