eep..forgot to cast it. ok thats all for now. thanks for the help.
A H wrote: > > ok thanks, this is what i have: > > MgPolygonCollection polygons = new MgPolygonCollection(); > MgAgfReaderWriter geometryReaderWriter = new > MgAgfReaderWriter(); > MgGeometryFactory geometryFactory = new MgGeometryFactory(); > > while(featureReader.ReadNext()) > { > MgByteReader temp = featureReader.GetGeometry("GEOM"); > MgPolygon polygon = (MgPolygon) > geometryReaderWriter.Read(temp); > polygons.Add(polygon); > } > > MgMultiPolygon newPolygon = > geometryFactory.CreateMultiPolygon(polygons); > > MgByteReader geom = geometryReaderWriter.Write(newPolygon); > > but the ,MgPolygon tempPoly = geometryReaderWriter.Read(temp); part didn't > work. > how can i easily create a MgPolygon using MgGeometry? > > > > Kenneth Skovhede, GEOGRAF A/S wrote: >> >> Perhaps you are looking for a MultiPolygon object? >> http://mapguide.osgeo.net/files/mapguide/docs/webapi/d3/dc6/class_mg_multi_polygon.html >> >> For creating a MultiPolygon, look here: >> http://mapguide.osgeo.net/files/mapguide/docs/webapi/d4/d46/class_mg_geometry_factory_bcbcf723fb0d1e58dbd7e030ed34022f.html#bcbcf723fb0d1e58dbd7e030ed34022f >> >> If you have other objects besides polygons, you need a >> GeometryCollection object, but that is poorly supported IMO. >> >> Regards, Kenneth Skovhede, GEOGRAF A/S >> >> >> >> A H skrev: >>> this should be easy, but i'm still having trouble figuring out. >>> >>> i have a system that allow user to draw multiple polygons, and save the >>> polygon into a spatial database. >>> >>> i have this code >>> >>> MgFeatureQueryOptions queryStr = new MgFeatureQueryOptions(); >>> queryStr.SetFilter("ID > 0"); >>> MgFeatureReader featureReader = >>> polyLayer.SelectFeatures(queryStr); >>> >>> featureReader.ReadNext(); >>> MgByteReader geom = featureReader.GetGeometry("GEOM"); >>> >>> MgPropertyCollection properties = new MgPropertyCollection(); >>> >>> properties.Add(new MgInt64Property("AREA_ID", areaID)); >>> properties.Add(new MgStringProperty("AREA_NAME", areaName)); >>> properties.Add(new MgGeometryProperty(GEOM_PROPERTY, geom)); >>> >>> >>> but this will only get geometry of 1 of the polygons. >>> can someone help me to modify this so that it save all the polygons into >>> 1 >>> new area that consist of the polygons in 'geom'? >>> >>> i'm thinking of something like: >>> >>> while(featureReader.ReadNext()) >>> { >>> // store the results into 1 geometry >>> // read into MgByteReader >>> } >>> >>> >>> >> _______________________________________________ >> mapguide-users mailing list >> mapguide-users@lists.osgeo.org >> http://lists.osgeo.org/mailman/listinfo/mapguide-users >> >> > > -- View this message in context: http://n2.nabble.com/Combining-features-tp2249387p2256747.html Sent from the MapGuide Users mailing list archive at Nabble.com. _______________________________________________ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users