[gdal-dev] ordering of layers

Nikhil Sai Parupalli nikhil.parupalli at iictechnologies.com
Thu Oct 25 04:10:12 PDT 2012


Hi ,

I am trying to load a S57 dataset to my map control using GDAL.
I have diff types of layers i.e
Polygon, Point, Line and multipoint

Here I want to show polygon in the base and points and lines on top of it my code is as follows

 if (layerType == "POLYGON")
                            {
                                FeatureSet fs = new FeatureSet(dt, 1, true, DotSpatial.Topology.FeatureType.Polygon);
                                fs.DataTable = dt.Clone();
                                var c = new DotSpatial.Topology.Coordinate[arrCoordinatesX.Count - 1];
                                for (int k = 0; k < arrCoordinatesX.Count - 1; k++)
                                {
                                    c[k] = new DotSpatial.Topology.Coordinate(Convert.ToDouble(arrCoordinatesX[k]), Convert.ToDouble(arrCoordinatesY[k]));
                                }
                                DotSpatial.Topology.Polygon LS = new DotSpatial.Topology.Polygon(c);
                                DotSpatial.Data.IFeature currentFeature = fs.AddFeature(LS);
                                uxMap.Layers.Add(fs);
                            }


                            else if (layerType == "LINESTRING")
                            {
                                FeatureSet fs = new FeatureSet(dt, 1, true, DotSpatial.Topology.FeatureType.Line);
                                fs.DataTable = dt.Clone();
                                List<DotSpatial.Topology.Coordinate> coordinates = new List<DotSpatial.Topology.Coordinate>();
                                for (int k = 0; k <= arrCoordinatesX.Count - 1; k++)
                                {
                                    coordinates.Add(new DotSpatial.Topology.Coordinate(Convert.ToDouble(arrCoordinatesX[k]), Convert.ToDouble(arrCoordinatesY[k])));
                                }
                                DotSpatial.Topology.LineString LS = new DotSpatial.Topology.LineString(coordinates);
                                DotSpatial.Data.IFeature currentFeature = fs.AddFeature(LS);
                                uxMap.Layers.Add(fs);
                                foreach (DataRow row in dt.Rows)
                                {
                                }
                            }
                            else if (layerType == "POINT")
                            {
                                FeatureSet fs = new FeatureSet(dt, 1, true, DotSpatial.Topology.FeatureType.Point);
                                fs.DataTable = dt.Clone();
                                foreach (DataRow row in dt.Rows)
                                {
                                    for (int k = 0; k <= arrCoordinatesX.Count - 1; k++)
                                    {
                                        DotSpatial.Topology.Coordinate c = new DotSpatial.Topology.Coordinate(Convert.ToDouble(arrCoordinatesX[k]), Convert.ToDouble(arrCoordinatesY[k]));

                                        DotSpatial.Topology.Point p = new DotSpatial.Topology.Point(c);
                                        DotSpatial.Data.IFeature currentFeature = fs.AddFeature(p);
                                        //PointCheck(ds);
                                    }
                                    uxMap.Layers.Add(fs);
                                    //uxMap.Layers.OrderByDescending(fs, 1);

                                }
                            }

                          else   if (layerType == "MULTIPOINT")
                            {
                                FeatureSet fs = new FeatureSet(dt, 1, true, DotSpatial.Topology.FeatureType.Point);
                                fs.DataTable = dt.Clone();
                                foreach (DataRow row in dt.Rows)
                                {
                                    DotSpatial.Topology.Point p = new DotSpatial.Topology.Point();
                                    for (int k = 0; k <= arrCoordinatesX.Count - 1; k++)
                                    {
                                        DotSpatial.Topology.Coordinate c = new DotSpatial.Topology.Coordinate(Convert.ToDouble(arrCoordinatesX[k]), Convert.ToDouble(arrCoordinatesY[k]));
                                        p = new DotSpatial.Topology.Point(c);
                                        DotSpatial.Data.IFeature currentFeature = fs.AddFeature(p);
                                    }
                                    DotSpatial.Topology.MultiPoint mp = new DotSpatial.Topology.MultiPoint(p);
                                    uxMap.Layers.Add(fs);
                                }
                            }
                        }
                        dt.Rows.Clear();
                    }
                }


So how to control this layer order so that i can see all the layers in a single map window


Thanks and Regards
Nikhil Sai Parupalli



Note: Do not print this email until and unless it is really required. Save paper , stay Green
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20121025/0abde605/attachment.html>


More information about the gdal-dev mailing list