示例#1
0
        public bool CreateLayer(string name, OSGeo.OGR.wkbGeometryType type, string save_featuresourcepath, string save_stylepath)
        {
            FeatureSource featuresource = this.gdb.CreateFeatureSource(Schema.CreateSchema(name, type), save_featuresourcepath);
            Layer         layer         = Layer.LoadLayer(featuresource, name, save_stylepath);

            layerlist.Insert(0, layer);
            return(true);
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="gdb"></param>
        /// <param name="mapname"></param>
        /// <param name="stylepath">mapproject必须给相同数量的stylepath,如果没有value应该为null,key为layername</param>
        /// <returns></returns>
        public static mapcontent LoadMapContent(string mapname, Dictionary <string, string> datasourcepath, Dictionary <string, string> stylepath, string server, string port, string username, string password, string database)
        {
            List <Layer> layerlist = new List <Layer>();
            GeoDatabase  gdb       = PGGeoDatabase.GetGeoDatabase(server, port, username, password, database, datasourcepath.Values.ToList());

            //Dictionary<String, FeatureSource> dic = gdb.featureSources;
            foreach (string layername in datasourcepath.Keys)
            {
                //获取featuresoucre
                FeatureSource featuresource = null;
                if (!gdb.featureSources.TryGetValue(datasourcepath[layername], out featuresource))
                {
                    continue;
                }

                Layer layer = Layer.LoadLayer(featuresource, layername, stylepath[layername]);
                layerlist.Add(layer);
            }
            mapcontent map = new mapcontent(mapname, gdb, layerlist);

            return(map);
        }