[ZS0] [mapguide-users] Combining features

Kenneth Skovhede, GEOGRAF A/S ks at geograf.dk
Sat Jan 31 11:33:39 EST 2009


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
>    }
>
>
>   


More information about the mapguide-users mailing list