[mapguide-users] Having problem in adding a layer to the map permanently

James Card James.Card at calcad.com
Fri Jul 31 12:34:34 EDT 2009


On Fri, 31 Jul 2009 03:53:19 -0700, Chandan Kumar <chandany5 at gmail.com>  
wrote:

> $byteSource = new MgByteSource($layerDefinition,  
> strlen($layerDefinition));
> $byteSource->SetMimeType(MgMimeType::Xml);
> $resourceId = new
> MgResourceIdentifier("Library://Samples/Sheboygan/Layers/RecentlyBuilt.LayerDefinition");
> $resourceService->SetResource($resourceId, $byteSource->GetReader(),  
> null);
> $map->Save($resourceService);
>
> This code successfully saves the new layer to the library but when I  
> refresh the page it no longer appears on the map I mean it does not adds  
> this layer to map permanently. Kindly tell me how can I get the layer  
> appear on the map permanently. It would be very helpful If someone could  
> provide me some code also.

After you've saved your new layer definition you must then modify your  
MapDefinition(s) so it includes your new layer. I posted some code to this  
list last year that shows how this is done (sorry I don't have quick  
access to that code, nor the mail archive, right now to find it again).

-- 
James Card
California CAD Solutions, Inc.
209-578-5580 - Voice
209-521-6493 - FAX


More information about the mapguide-users mailing list