[mapguide-users] lines over maps

GM_Mizar giampiero.massa at torino.miz.it
Fri Mar 2 06:27:11 EST 2007


Another update...

I've changed the data connection using shape files instead SDF and now my
code works (or at least doesn't return errors...)

I can read the inserted feature id using the feature reader returned by the
UpdateFeatures method (through the MgPropertyCollection) but....nothing
appear on map!

Where am I wrong?

GM


GM_Mizar wrote:
> 
> still here with my problem, but I have news....
> 
> I understood why I couldn't get the class definition, the
> roadLayer.GetFeatureClassName() returns the entire class name with schema
> but the GetClassDefinition method only want the class...
> 
> I also understood that I cannot use an ODBC data feature because it only
> supports points.
> 
> I've used an empty shape file (created for polylines) and I've created a
> data feature with name GP. I've also created a layer with name "ROADS_SHP"
> that uses this data feature, in map studio I've defined the line style
> (red and very thick).
> 
> Now, in my web page I define the new line using these lines of code:
> 
> MgPropertyCollection propertyCollection = new MgPropertyCollection();
> MgInt32Property roadIdProperty = new MgInt32Property("FeatId", roadId);
> propertyCollection.Add(roadIdProperty);
> 
> MgWktReaderWriter wktReaderWriter = new MgWktReaderWriter();
> MgAgfReaderWriter agfReaderWriter = new MgAgfReaderWriter();
> 
> MgGeometry geometry = wktReaderWriter.Read("LINESTRING XY (1510743 5040034
> 1510909 5040338)");
> MgByteReader geometryByteReader = agfReaderWriter.Write(geometry);
> MgGeometryProperty geometryProperty = new MgGeometryProperty("Geometry",
> geometryByteReader);
> propertyCollection.Add(geometryProperty);
> 
> MgBatchPropertyCollection batchPropertyCollection = new
> MgBatchPropertyCollection();
> batchPropertyCollection.Add(propertyCollection);
> 
> MgInsertFeatures cmd = new MgInsertFeatures("GP",
> batchPropertyCollection);
> MgFeatureCommandCollection featureCommandCollection = new
> MgFeatureCommandCollection();
> featureCommandCollection.Add(cmd);
> 
> // execute the "add" commands
> MgPropertyCollection retColl =
> featureService.UpdateFeatures(resourceIdentifier,
> featureCommandCollection, false);
> 
> 
> Now, what I get is a collection of property with only one element (it'
> because I've only one command I think), I'm expecting a MgInt32Property
> but I get a MgStringProperty with this value:
> 
> An exception occurred in FDO component.
> Cannot write to SDF file. Connection is read-only. 
> Exception occurred in method MgServerUpdateFeatures.UpdateFeatures at line
> 93 in file c:\build_bond_area\mapguide_open_source\build_3.1
> mgdev\server\src\services\feature\ServerUpdateFeatures.cpp
> 
> Why my data feature is read only?
> 
> Thanks a lot for every kind of reply.
> 
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/lines-over-maps-tf3328503s16610.html#a9267938
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list