[mapguide-users] try to update SDF FeatureSource...my codedon'twork.

andrea tiveron - metodi srl andrea.tiveron at e-metodi.it
Tue Apr 10 11:16:48 EDT 2007


I want replace ReadOnly flag to false programmatically by code
but my code isn't correct
I don't know why?

here is the code:

                    // Create a filter containing the IDs of the selected
features on this layer        
                    $layerClassName = $layer->GetFeatureClassName();
                    $selectionString = $selection->GenerateFilter($layer,
$layerClassName);
                    // Get the feature resource for the selected layer
                    $layerFeatureId = $layer->GetFeatureSourceId();
                    $byteReader =
$resourceService->GetResourceContent($layerFeatureId);
                    $strMapXML = $byteReader->ToString();
                    $insertPoint = strpos($strMapXML,'<Value>TRUE</Value>');
                    if ($insertPoint != '')
                        {
                        $content = trim(substr_replace($strMapXML,
'<Value>FALSE</Value>', $insertPoint, 19));
                        $resourceService->SetResource($featureSourceId,
$content, NULL);
                        }

andrea

-----Original Message-----
From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Jason Birch
Sent: Friday, March 02, 2007 5:37 PM
To: MapGuide Users Mail List
Subject: RE: [mapguide-users] try to update SDF FeatureSource...my
codedon'twork.

Maciek wrote:
--------------
i try update SDF FeatureSource (Roads name of Samples/Sheboygan data form
MGOS download page) whithout any results
--------------

This may be the same problem that we were having earlier this week.

When SDF files are initially added to the repository, their ReadOnly flag
(or something like that) is set to TRUE.  This needs to be modified using
the pages installed on your MapGuide server under
/mapguide/mapagent/index.html

First, do a GetResourceContent, specifying
Library://Samples/Sheboygan/Data/RoadCenterLines.FeatureSource as your
ResourceID

This will give you an XML representation of your data connection's
definition.  View the source of this page, copy it into a text editor and
modify the following section:

  <Parameter>
    <Name>ReadOnly</Name>
    <Value>TRUE</Value>
  </Parameter>

replacing TRUE with FALSE.

Save this file to your local computer.

Now go back to the mapagent forms, and open the SetResource form.  In this
form, specify your ResourceID
(Library://Samples/Sheboygan/Data/RoadCenterLines.FeatureSource) and
browsing to the location of your saved XML file in the Content section.
You do not need to fill in the Header area.

Once this is submitted, you should be able to modify your SDF file.

Jason
_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users



More information about the mapguide-users mailing list