[mapguide-users] FW: guestion about update feature source
Farah
farah at egovernments.org
Mon Mar 19 05:19:02 EDT 2007
Hi Maciej,
I did try this sample in java and it did work. The following is the code:
MgMap map = new MgMap();
map.Open(resourceService, "Sheboygan");
MgResourceIdentifier resId = new
MgResourceIdentifier("Library://Samples/Sheboygan/Data/RoadCenterLines
.FeatureSource");
String filter = "ID = " + 2536 ;
MgFeatureCommandCollection commands = new
MgFeatureCommandCollection();
MgPropertyCollection properties = new MgPropertyCollection();
String name = "nowa";
properties.Add(new MgStringProperty("NAME",name ));
MgUpdateFeatures updateCommandRed = new
MgUpdateFeatures("RoadCenterLines", properties, filter);
commands.Add(updateCommandRed);
//exceute commands
if (commands.GetCount() >=1 )
{
ReleaseReader(featureService.UpdateFeatures(resId, commands, false),
commands);
}
//Now test if name has changed:
MgFeatureQueryOptions queryOptions = new MgFeatureQueryOptions();
queryOptions.SetFilter(filter);
MgFeatureReader featureReader = featureService.SelectFeatures(resId,
"RoadCenterLines", queryOptions);
while (featureReader.ReadNext())
{
String newname = featureReader.GetString("NAME");
String id = featureReader.GetString("ID");
out.write("Name after changing:" + newname);
out.write("ID :" + id);
}
However for this sample to work, I had to change the ReadOnly flag of
RoadCenterLines.FeatureSource to FALSE ( according to previous posts).
Hope this helps...
Regards
Farah
-----Original Message-----
From: Maciej Skorczewski [mailto:maciej.skorczewski at procad.pl]
Sent: Thursday, March 15, 2007 6:34 PM
To: Farah
Subject: guestion about update feature source
helo again :)
Farah some time ago i write to you whiy question how to update feature
source?
i get response from you whit code i java.
i fight whit this truble an still no results...i try update
Library://Samples/Sheboygan/Data/RoadCenterLines.FeatureSource
(example of data to MGOS)
i must update name of streets in this source to make demo in my language.:(
if you have some time can you write this ex. in JAVA or PHP?
i thing that this is small problem.Mayby can you try modyfiy yours code
to make this...i will be very grateful for any help.
this is my post on mailinglist
http://www.nabble.com/try-to-update-SDF-FeatureSource...my-code-don%27t-work
.-tf3333895s16610.html#a9270473
maciek
Disclaimer by Mail Administrator - Yukthi
More information about the mapguide-users
mailing list